mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-21 08:06:27 -04:00
Merge branch 'master' into qa
* master: actually implement the brozzler-list-jobs --job option
This commit is contained in:
commit
6f41c70892
@ -411,11 +411,25 @@ def brozzler_list_jobs():
|
||||
configure_logging(args)
|
||||
|
||||
rr = rethinker(args)
|
||||
reql = rr.table('jobs').order_by('id')
|
||||
if not args.all:
|
||||
reql = reql.filter({'status': 'ACTIVE'})
|
||||
logging.debug('querying rethinkdb: %s', reql)
|
||||
results = reql.run()
|
||||
if args.job is not None:
|
||||
try:
|
||||
job_id = int(args.job)
|
||||
except ValueError:
|
||||
job_id = args.job
|
||||
reql = rr.table('jobs').get(job_id)
|
||||
logging.debug('querying rethinkdb: %s', reql)
|
||||
result = reql.run()
|
||||
if result:
|
||||
results = [reql.run()]
|
||||
else:
|
||||
logging.error('no such job with id %s', repr(job_id))
|
||||
sys.exit(1)
|
||||
else:
|
||||
reql = rr.table('jobs').order_by('id')
|
||||
if args.active:
|
||||
reql = reql.filter({'status': 'ACTIVE'})
|
||||
logging.debug('querying rethinkdb: %s', reql)
|
||||
results = reql.run()
|
||||
if args.yaml:
|
||||
yaml.dump_all(
|
||||
results, stream=sys.stdout, explicit_start=True,
|
||||
|
Loading…
x
Reference in New Issue
Block a user