--filter-all KEYWORDS Only run jobs whose description contains each one
of the keywords in the comma separated keyword
string specified.
+ -F, --filter-fragments <bool>
+ Check yaml fragments too if job description
+ does not match the filters provided with
+ options --filter, --filter-out, and --filter-all.
+ [default: false]
--archive-upload RSYNC_DEST Rsync destination to upload archives.
--archive-upload-url URL Public facing URL where archives are uploaded.
--throttle SLEEP When scheduling, wait SLEEP seconds between jobs.
from teuthology.repo_utils import build_git_url
from teuthology.suite import util
-from teuthology.suite.build_matrix import combine_path, build_matrix
+from teuthology.suite.build_matrix import build_matrix
from teuthology.suite.placeholder import substitute_placeholders, dict_templ
log = logging.getLogger(__name__)
jobs_to_schedule = []
jobs_missing_packages = []
for description, fragment_paths in configs:
- base_frag_paths = [
- util.strip_fragment_path(x) for x in fragment_paths
- ]
if limit > 0 and len(jobs_to_schedule) >= limit:
log.info(
'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.
- 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_all = self.args.filter_all
- if filter_all:
- if not all(matches(f) for f in filter_all):
- continue
- filter_in = self.args.filter_in
- if filter_in:
- if not any(matches(f) for f in filter_in):
- continue
- filter_out = self.args.filter_out
- if filter_out:
- if any(matches(f) for f in filter_out):
- continue
raw_yaml = '\n'.join([open(a, 'r').read() for a in fragment_paths])
log.info("pause between jobs : --throttle " + str(throttle))
time.sleep(int(throttle))
+
def schedule_suite(self):
"""
Schedule the suite-run. Returns the number of jobs scheduled.
self.base_config.suite.replace(':', '/'),
))
log.debug('Suite %s in %s' % (suite_name, suite_path))
- configs = [
- (combine_path(suite_name, item[0]), item[1]) for item in
- build_matrix(suite_path, subset=self.args.subset, seed=self.args.seed)
- ]
+ configs = build_matrix(suite_path,
+ subset=self.args.subset,
+ seed=self.args.seed)
log.info('Suite %s in %s generated %d jobs (not yet filtered)' % (
suite_name, suite_path, len(configs)))
limit = self.args.newest
while backtrack <= limit:
jobs_missing_packages, jobs_to_schedule = \
- self.collect_jobs(arch, configs, self.args.newest, job_limit)
+ self.collect_jobs(arch,
+ util.filter_configs(configs,
+ filter_in=self.args.filter_in,
+ filter_out=self.args.filter_out,
+ filter_all=self.args.filter_all,
+ filter_fragments=self.args.filter_fragments,
+ suite_name=suite_name),
+ self.args.newest, job_limit)
if jobs_missing_packages and self.args.newest:
new_sha1 = \
util.find_git_parent('ceph', self.base_config.sha1)
from teuthology.orchestra.opsys import OS
from teuthology.packaging import get_builder_project
from teuthology.repo_utils import build_git_url
+from teuthology.suite.build_matrix import combine_path
from teuthology.task.install import get_flavor
log = logging.getLogger(__name__)
return sha1s[1]
else:
return None
+
+
+def filter_configs(configs, suite_name=None,
+ filter_in=None,
+ filter_out=None,
+ filter_all=None,
+ filter_fragments=True):
+ """
+ Returns a generator for pairs of description and fragment paths.
+
+ Usage:
+
+ configs = build_matrix(path, subset, seed)
+ for description, fragments in filter_configs(configs):
+ pass
+ """
+ for item in configs:
+ fragment_paths = item[1]
+ description = combine_path(suite_name, item[0]) \
+ if suite_name else item[0]
+ base_frag_paths = [strip_fragment_path(x)
+ for x in fragment_paths]
+ def matches(f):
+ if f in description:
+ return True
+ if filter_fragments and \
+ any(f in path for path in base_frag_paths):
+ return True
+ return False
+ if filter_all:
+ if not all(matches(f) for f in filter_all):
+ continue
+ if filter_in:
+ if not any(matches(f) for f in filter_in):
+ continue
+ if filter_out:
+ if any(matches(f) for f in filter_out):
+ continue
+ yield([description, fragment_paths])