]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add option to schedule jobs using simple subset
authorVasu Kulkarni <vasu@redhat.com>
Sat, 27 Jan 2018 02:32:15 +0000 (18:32 -0800)
committerVasu Kulkarni <vasu@redhat.com>
Thu, 14 Feb 2019 20:28:12 +0000 (12:28 -0800)
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 <vasu@redhat.com>
scripts/suite.py
teuthology/suite/run.py

index 2e8596f668d9a853ab040bef62ed47ff3e89d975..84d7803f4fe8d314a06fac6f79091ec775e29053 100644 (file)
@@ -91,6 +91,12 @@ Scheduler arguments:
                               piece <index>.  Scheduling 0/<outof>, 1/<outof>,
                               2/<outof> ... <outof>-1/<outof> will schedule all
                               jobs in the suite (many more than once).
+  --simple-subset <index/outof>
+                              Instead of scheduling the entire suite, break the
+                              set of jobs into <outof> pieces, If --dry-run
+                              produces 400 jobs, with <outof> 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>, --priority <priority>
                               Job priority (lower is sooner)
                               [default: 1000]
index e34e6012d3f6fc56d58af140dae16e64dcf00666..485bb6e7499f728bc93bcd178e90767bb336df04 100644 (file)
@@ -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)