Skip to content

Conversation

@aiChaoSONG
Copy link

If we have two pipelines with id=1 and id=10, current
RE is not able to filter these two pipelines from each
other.

This patch deprecates RE and use string comparison for
pipeline filtering.

Signed-off-by: Chao Song chao.song@linux.intel.com

If we have two pipelines with id=1 and id=10, current
RE is not able to filter these two pipelines from each
other.

This patch deprecates RE and use string comparison for
pipeline filtering.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
@plbossart
Copy link
Member

SOFCI TEST

@plbossart
Copy link
Member

Timeout of APL_NOCODEC is gone with retest.

I also tested this PR locally on UP2-nocodec and UpExtreme-nocodec, no issues reported.

No idea what the pylint error means or if there's a better way to write this in Python but the concept is sound. Thanks @aiChaoSONG for the fix.

Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to "reverse-engineer" way too much code to review this small fix :-( #714 is a pure doc fix to avoid anyone having to go through the same pain again. Among other things it warns about the missing boolean precedence.

if type(value) == list:

The previous code supported only type(value) == list so please don't introduce this new "feature". Certainly not silently when fixing something unrelated and... probably never.

# check if current pipeline is the one we want

check if current pipeline is AMONG the ones we want

marc-hb pushed a commit to marc-hb/sof-test that referenced this pull request Jun 21, 2021
Modified version of thesofproject#713 for pure testing purposes.

If we have two pipelines with id=1 and id=10, current
RE is not able to filter these two pipelines from each
other.

This patch deprecates RE and use string comparison for
pipeline filtering.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
marc-hb pushed a commit to marc-hb/sof-test that referenced this pull request Jun 21, 2021
If we have two pipelines with id=1 and id=10, current
RE is not able to filter these two pipelines from each
other.

This patch deprecates RE and use string comparison for
pipeline filtering.

v2 by Marc: don't add support for non-lists, see thesofproject#713 review for
details.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
marc-hb pushed a commit to marc-hb/sof-test that referenced this pull request Jun 21, 2021
If we have two pipelines with id=1 and id=10, current
RE is not able to filter these two pipelines from each
other.

This patch deprecates RE and use string comparison for
pipeline filtering.

v2 by Marc: don't add support for non-lists, see thesofproject#713 review for
details.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
check = True if key in line.keys() else False
else:
# match for 'keyword'/'keyword [0-9]' target line
check = len ([em for em in value if re.match(em + '$|' + em + '[^a-zA-Z]', str(line[key]), re.I)]) > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of Pylint warnings are making sense.

tools/sof-tplgreader.py:3:0: W0611: Unused import subprocess (unused-import)
tools/sof-tplgreader.py:4:0: W0611: Unused import os (unused-import)
tools/sof-tplgreader.py:5:0: W0611: Unused import re (unused-import)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pylint warnings fixed in no functional change PR #714, please help review

Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code supported only type(value) == list so please don't introduce this new "feature". Certainly not silently when fixing something unrelated and... probably never.

@plbossart told me he needs this fix urgently so I applied my own suggestion above and resubmitted #715 to supersede this. Apologies.

check = True if key in line.keys() else False
else:
# match for 'keyword'/'keyword [0-9]' target line
check = len ([em for em in value if re.match(em + '$|' + em + '[^a-zA-Z]', str(line[key]), re.I)]) > 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pylint warnings fixed in no functional change PR #714, please help review

marc-hb pushed a commit that referenced this pull request Jun 21, 2021
If we have two pipelines with id=1 and id=10, current
RE is not able to filter these two pipelines from each
other.

This patch deprecates RE and use string comparison for
pipeline filtering.

v2 by Marc: don't add support for non-lists, see #713 review for
details.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb marc-hb closed this Jun 21, 2021
@aiChaoSONG
Copy link
Author

@marc-hb it is correct to exclude the non-list support, actually I spend some time to understand check = len ([em for em in value if re.match(em + '$|' + em + '[^a-zA-Z]', str(line[key]), re.I)]) > 0 too.

@marc-hb
Copy link
Collaborator

marc-hb commented Jun 22, 2021

First, I'm sorry I rushed #715 before we could have this discussion, that's bad. I blame @plbossart, he made me do it! He's always pushing everyone to rush things out... :'-D

Second, you shouldn't have approved my doc fix #714 if you think the code was supposed to support both lists and non-lists! Because I'm loudly saying the opposite in doc fixes #714 I mixed that up with something else.

Now back to the main question. This function is invoked in only one other function: _filter_by_dict() that consumes the output of parse_dict(). In parse_dict(), value is produced by the expression value.strip.split(',')` which always produces a list even when there is a single element in the user input. I traced and verified that.

I did spent a little bit of time looking at the removed regex code and I don't understand how it would make sense if value was not a list but only a string. In that case em would iterate on every character of the input string, so for instance for { 'type' : 'capture' } then em would iterate like this: c, a, p, t,...... how would that make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants