doc = """
usage: teuthology-queue -h
- teuthology-queue -m MACHINE_TYPE
- teuthology-queue -m MACHINE_TYPE -d PATTERN
+ teuthology-queue [-d] -m MACHINE_TYPE
+ teuthology-queue -m MACHINE_TYPE -D PATTERN
List Jobs in queue:
If -d then jobs with PATTERN in the job name are deleted from the queue.
Which machine type queue to work on.
optional arguments:
- -h, --help show this help message and exit
+ -h, --help Show this help message and exit
+ -D, --delete PATTERN Delete Jobs with PATTERN in their name
+ -d, --description Show job descriptions
- -d, --delete PATTERN Delete Jobs with PATTERN in their name.
""".format(archive_base=teuthology.config.config.archive_base)
return beanstalk
-def walk_jobs(beanstalk, machine_type, delete=None):
+def walk_jobs(beanstalk, machine_type, show_desc=False, delete=None):
job_count = beanstalk.stats_tube(machine_type)['current-jobs-ready']
if job_count == 0:
log.info('No jobs in Beanstalk Queue')
x=x, count=job_count)
print m,
else:
- m = 'Job: {x}/{count} ID: {job_id} Name: {job_name}'.format(
+ m = 'Job: {x}/{count} {job_name}/{job_id}'.format(
x=x,
count=job_count,
job_id=job_id,
job_name=job_name,
)
print m
- if job_description:
+ if job_description and show_desc:
for desc in job_description.split():
print '\t {desc}'.format(desc=desc)
log.info("Finished checking Beanstalk Queue.")
def main(args):
machine_type = args['--machine_type']
delete = args['--delete']
+ show_desc = args['--description']
beanstalk = beanstalk_connect(machine_type)
- walk_jobs(beanstalk, machine_type, delete)
+ walk_jobs(beanstalk, machine_type, show_desc=show_desc, delete=delete)
beanstalk.close()