]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
schedule: add a way to delete jobs from the queue
authorJosh Durgin <josh.durgin@dreamhost.com>
Thu, 1 Sep 2011 00:43:14 +0000 (17:43 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Thu, 1 Sep 2011 00:43:14 +0000 (17:43 -0700)
teuthology/run.py

index 32b54c63051bb1bccd22b138c1f6927fcf1fae2a..e60c6885e3cb6985145620d5917eddf06d6e60ce 100644 (file)
@@ -172,7 +172,6 @@ def schedule():
         )
     parser.add_argument(
         '--name',
-        required=True,
         help='name of suite run the job is part of',
         )
     parser.add_argument(
@@ -204,6 +203,13 @@ def schedule():
         '--owner',
         help='job owner',
         )
+    parser.add_argument(
+        '--delete',
+        metavar='JOBID',
+        type=int,
+        nargs='*',
+        help='list of jobs to remove from the queue',
+        )
     parser.add_argument(
         '-v', '--verbose',
         action='store_true',
@@ -226,6 +232,16 @@ def schedule():
     beanstalk = teuthology.queue.connect(ctx)
 
     beanstalk.use('teuthology')
+
+    if ctx.delete:
+        for jobid in ctx.delete:
+            job = beanstalk.peek(jobid)
+            if job is None:
+                print 'job {jid} is not in the queue'.format(jid=jobid)
+            else:
+                job.delete()
+        return
+
     job = yaml.safe_dump(dict(
             config=ctx.config,
             name=ctx.name,