]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Make help a bit more obvious. Misc tweeks.
authorSandon Van Ness <sandon@inktank.com>
Wed, 26 Feb 2014 03:57:41 +0000 (19:57 -0800)
committerSandon Van Ness <sandon@inktank.com>
Wed, 26 Feb 2014 03:57:41 +0000 (19:57 -0800)
Put each yaml in the job_description on its own line so not so
wide of a line. Make delete default None not False in function.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
scripts/queue.py
teuthology/beanstalk.py

index e89b19ee29f34b4dc97d8022bc1ea8ca0812e2a1..3ffefc1237f358f94f213b176e7f732701e65669 100644 (file)
@@ -8,7 +8,7 @@ usage: teuthology-queue [-h] -m MACHINE_TYPE
        teuthology-queue [-h] -m MACHINE_TYPE -d JOB
 
 List Jobs in queue:
-  If -d then jobs with JOB in the job name are delete from the queue.
+  If -d then jobs with JOB in the job name are deleted from the queue.
 
 Arguments:
   -m, --machine_type MACHINE_TYPE
@@ -17,7 +17,7 @@ Arguments:
 optional arguments:
   -h, --help            show this help message and exit
 
-  -d, --delete JOB      Delete Jobs with JOB in jobname.
+  -d, --delete JOB      Delete Jobs JOB in their name.
 
 """.format(archive_base=teuthology.config.config.archive_base)
 
index e8489c16cb7fd5074c62a498b0fa68dee62232db..df809fb9df1a0c9a627b0619675346c754b88805 100644 (file)
@@ -19,37 +19,39 @@ def beanstalk_connect(machine_type):
     beanstalk.ignore('default')
     return beanstalk
 
-def walk_jobs(beanstalk, machine_type, delete=False):
+def walk_jobs(beanstalk, machine_type, delete=None):
     curjobs = beanstalk.stats_tube(machine_type)['current-jobs-ready']
     if curjobs != 0:
         x=1
         while x != curjobs:
             x += 1
             job = beanstalk.reserve(timeout=20)
-            if job.body is not None:
-                job_config = yaml.safe_load(job.body)
-                job_name=job_config['name']
-                job_id = job.stats()['id']
-                job_description = job_config['description']
-                if delete:
-                    if delete in job_name:
-                        print 'Deleted Job: {job_id} from queue. Name: {job_name}'.format(
-                        job_id = job_id,
-                        job_name = job_name,
-                        )
-                        job.delete()
+            if job is not None:
+                if job.body is not None:
+                    job_config = yaml.safe_load(job.body)
+                    job_name=job_config['name']
+                    job_id = job.stats()['id']
+                    job_description = job_config['description']
+                    if delete:
+                        if delete in job_name:
+                            print 'Deleted Job: {job_id} from queue. Name: {job_name}'.format(
+                            job_id = job_id,
+                            job_name = job_name,
+                            )
+                            job.delete()
+                        else:
+                            print "Searching queue... Checked " + str(x) + "/" + str(curjobs)," Jobs\r",
                     else:
-                        print "Searching queue... Checked " + str(x) + "/" + str(curjobs)," Jobs\r",
-                else:
-                    print 'Job: {x}/{curjobs} ID: {job_id} Name: {job_name}'.format(
-                    x=x,
-                    curjobs=curjobs,
-                    job_id=job_id,
-                    job_name=job_name,
-                    )
-                    print '\t {desc}'.format(desc=job_description)
-
-        print "\nDone"
+                        print 'Job: {x}/{curjobs} ID: {job_id} Name: {job_name}'.format(
+                        x=x,
+                        curjobs=curjobs,
+                        job_id=job_id,
+                        job_name=job_name,
+                        )
+                        if job_description:
+                            for desc in job_description.split():
+                                print '\t {desc}'.format(desc=desc)
+        log.info("Finished checking Beanstalk Queue.")
     else:
         log.info('No jobs in Beanstalk Queue')