From: Vasu Kulkarni Date: Mon, 22 Jun 2020 09:32:26 +0000 (+0530) Subject: Add option to schedule jobs using simple subset X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6ef452ffb9697a79023df2b19bc7fae0cbfb1083;p=teuthology.git 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 --- diff --git a/scripts/suite.py b/scripts/suite.py index 98f7448111..eab41f6b17 100644 --- a/scripts/suite.py +++ b/scripts/suite.py @@ -119,6 +119,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/setup.py b/setup.py index 1c75d8cfc6..ee09fb904c 100644 --- a/setup.py +++ b/setup.py @@ -128,9 +128,7 @@ setup( 'teuthology-queue = scripts.queue:main', 'teuthology-prune-logs = scripts.prune_logs:main', 'teuthology-describe = scripts.describe:main', - 'teuthology-reimage = scripts.reimage:main' - 'teuthology-describe-tests = scripts.describe_tests:main', - 'teuthology-gencov = scripts.gencov:main', + 'teuthology-reimage = scripts.reimage:main', 'teuthology-polarion = scripts.polarion:main', ], }, diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index b84a6312b0..2a3fd47551 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -10,6 +10,7 @@ from humanfriendly import format_timespan from datetime import datetime from tempfile import NamedTemporaryFile +from math import floor from teuthology.config import config, JobConfig from teuthology.exceptions import ( @@ -542,6 +543,27 @@ Note: To force run, use --force-priority''' 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)