Merge pull request #351 from ceph/wip-9925-wusui

Allow more strings in filters
This commit is contained in:
Zack Cerza 2014-11-07 10:17:08 -07:00
commit c2d0e48012
2 changed files with 24 additions and 7 deletions

View File

@ -65,9 +65,12 @@ Scheduler arguments:
--timeout <timeout> How long, in seconds, to wait for jobs to finish
before sending email. This does not kill jobs.
[default: 32400]
--filter <string> Only run jobs containing the string specified.
--filter-out <string> Do not run jobs containing the string specified.
--filter KEYWORDS Only run jobs whose name contains at least one
of the keywords in the comma separated keyword
string specified.
--filter-out KEYWORDS Do not run jobs whose name contains any of
the keywords in the comma separated keyword
string specified.
"""

View File

@ -448,14 +448,28 @@ def schedule_suite(job_config,
'Stopped after {limit} jobs due to --limit={limit}'.format(
limit=limit))
break
# Break apart the filter parameter (one string) into comma separated
# components to be used in searches.
if filter_in:
if filter_in not in description:
if all([x.find(filter_in) < 0 for x in fragment_paths]):
filter_list = [x.strip() for x in filter_in.split(',')]
if not any([x in description for x in filter_list]):
all_filt = []
for filt_samp in filter_list:
all_filt.extend([x.find(filt_samp) < 0 for x in fragment_paths])
if all(all_filt):
continue
if filter_out:
if filter_out in description or any([filter_out in z for z in
fragment_paths]):
filter_list = [x.strip() for x in filter_out.split(',')]
if any([x in description for x in filter_list]):
continue
all_filt_val = False
for filt_samp in filter_list:
flist = [filt_samp in x for x in fragment_paths]
if any(flist):
all_filt_val = True
continue
if all_filt_val:
continue
raw_yaml = '\n'.join([file(a, 'r').read() for a in fragment_paths])