]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Added --limit option to teuthology-suite. 212/head
authorYuri Weinstein <yuri.weinstein@inktank.com>
Fri, 28 Feb 2014 00:34:58 +0000 (00:34 +0000)
committerYuri Weinstein <yuri.weinstein@inktank.com>
Fri, 28 Feb 2014 00:34:58 +0000 (00:34 +0000)
Use --limit to limit the number of jobs being scheduled during
teuthology-suite. Also can be used with schedule_suite.sh via the
10th argument.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
Signed-off-by: Yuri Weinstein <yuri.weinstein@inktank.com>
schedule_suite.sh
scripts/suite.py
teuthology/suite.py

index 5663b4e9bd4fc6e69453373b7c6d1f61787d3494..bb553b0cc7dd5fee39de80e942e30a79d0bacaba 100755 (executable)
@@ -9,6 +9,14 @@ teuthology_branch=$6
 mtype=$7
 template=$8
 distro=$9
+limit=${10}
+
+if [ -z "$limit" ]
+then
+    limitline=''
+else
+    limitline="--limit $limit"
+fi
 
 if [ -z "$kernel" ]; then
     echo "usage: $0 <suite> <ceph branch> <kernel branch> [email] [flavor] [teuthology-branch] [machinetype] [template] [distro]"
@@ -190,5 +198,6 @@ echo "name $name"
     --collections $suite \
     --email $email \
     --timeout 36000 \
+    $limitline \
     --name $name \
     --worker $tube
index d98709614a0f89aa6277189a7fa9dbe219de52fd..eb5503edefa0e4771d930ffbdc17ee070fd9d744 100644 (file)
@@ -69,6 +69,12 @@ combination, and will override anything in the suite.
         type=int,
         help='number of times to run/queue each job'
     )
+    parser.add_argument(
+        '-l', '--limit',
+        default=0,
+        type=int,
+        help='limit number of jobs in loop to N'
+    )
     parser.add_argument(
         '-w', '--worker',
         default='plana',
index d253e687195bb9ae5208310c488fe20438fd4c57..60d09e7a29fa8ca10b4331a6da577c3a805a2798 100644 (file)
@@ -37,7 +37,8 @@ def main(args):
         (os.path.join(args.base, collection), collection)
         for collection in args.collections
     ]
-
+    
+    count = 1
     num_jobs = 0
     for collection, collection_name in sorted(collections):
         log.debug('Collection %s in %s' % (collection_name, collection))
@@ -50,6 +51,12 @@ def main(args):
         arch = get_arch(args.config)
         machine_type = get_machine_type(args.config)
         for description, config in configs:
+            if args.limit > 0:
+                if count > args.limit:
+                    log.info('Stopped after {limit} jobs due to --limit={limit}'.format(
+                    limit=args.limit))
+
+                    break
             raw_yaml = '\n'.join([file(a, 'r').read() for a in config])
 
             parsed_yaml = yaml.load(raw_yaml)
@@ -95,6 +102,7 @@ def main(args):
                 subprocess.check_call(
                     args=arg,
                 )
+            count += 1
 
     if num_jobs:
         arg = copy.deepcopy(base_arg)