From 715feed1460598dda054a2744bca5b2d8216087a Mon Sep 17 00:00:00 2001 From: Vasu Kulkarni Date: Fri, 26 Jan 2018 18:32:15 -0800 Subject: [PATCH] Add option to schedule jobs using simple subset Total number of jobs are divided into equal subsets based on user options and can be scheduled using 1/10, 2/10 etc If a suite produces 100 jobs, 1/10 would schedule first 10 jobs, 2/10 will schedule next set of 10 jobs and so on. Signed-off-by: Vasu Kulkarni --- scripts/suite.py | 6 ++++++ teuthology/suite/run.py | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/scripts/suite.py b/scripts/suite.py index 2e8596f668..84d7803f4f 100644 --- a/scripts/suite.py +++ b/scripts/suite.py @@ -91,6 +91,12 @@ Scheduler arguments: piece . Scheduling 0/, 1/, 2/ ... -1/ will schedule all jobs in the suite (many more than once). + --simple-subset + Instead of scheduling the entire suite, break the + set of jobs into pieces, If --dry-run + produces 400 jobs, with value of 4, each + subset will produce 100 jobs, eg: 1/4 for above + will produce 100 jobs, 2/4 will produce next 100 jobs -p , --priority Job priority (lower is sooner) [default: 1000] diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index e34e6012d3..485bb6e749 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -8,6 +8,7 @@ import yaml from datetime import datetime from tempfile import NamedTemporaryFile +from math import floor from ..config import config, JobConfig from ..exceptions import ( @@ -493,9 +494,31 @@ class Run(object): (combine_path(suite_name, item[0]), item[1]) for item in 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))) + if self.args.simple_subset: + simple_subset = self.args.simple_subset + log.info("Using simple subset options %s " % simple_subset) + (sset, outof) = simple_subset.split('/') + sset = int(sset) + outof = int(outof) + if outof < len(configs): + cycle = floor(len(configs) / outof) + if sset == outof: + log.info("Final subset, including remainder jobs") + start = (sset-1) * cycle + end = len(configs) + else: + start = (sset-1) * cycle + end = start + (cycle-1) + start = int(start) + end = int(end) + log.info("using start index of %d , end index of %d" %(start, end)) + configs = configs[start:end] + log.info("Number of Jobs after simple subset are %d" % len(configs)) + if self.args.dry_run: log.debug("Base job config:\n%s" % self.base_config) -- 2.39.5