From: Kefu Chai Date: Fri, 17 Apr 2020 04:02:14 +0000 (+0800) Subject: teuthology/suite: extract match() for filtering jobs X-Git-Tag: 1.1.0~126^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1450%2Fhead;p=teuthology.git teuthology/suite: extract match() for filtering jobs for better readablity Signed-off-by: Kefu Chai --- diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index 7b2173523..2a421d5f1 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -373,24 +373,19 @@ class Run(object): break # Break apart the filter parameter (one string) into comma # separated components to be used in searches. + def matches(f): + if f in description: + return True + if any(f in path for path in base_frag_paths): + return True + return False filter_in = self.args.filter_in if filter_in: - if not any([x in description for x in filter_in]): - for filt_samp in filter_in: - if any(x.find(filt_samp) >= 0 for x in base_frag_paths): - break - else: - continue + if not any(matches(f) for f in filter_in): + continue filter_out = self.args.filter_out if filter_out: - if any([x in description for x in filter_out]): - continue - is_collected = True - for filt_samp in filter_out: - if any(filt_samp in x for x in base_frag_paths): - is_collected = False - break - if not is_collected: + if any(matches(f) for f in filter_out): continue raw_yaml = '\n'.join([open(a, 'r').read() for a in fragment_paths])