Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save snarkmaster/709e02df64cfc7402c5d963eb8ad45fd to your computer and use it in GitHub Desktop.
Save snarkmaster/709e02df64cfc7402c5d963eb8ad45fd to your computer and use it in GitHub Desktop.
response = query_bistro(args, {
'h': {'handler': 'histogram'},
'j': {'handler': 'jobs'},
})
jobs = response['j']['data']
histograms = response['h']['data']['histograms']
for job_id, job in jobs.iteritems():
print('Number of done or failed tasks for', job_id, '-', sum(
count for enc_bits, count in histograms[job_id][
job['level_for_tasks']
].iteritems()
for b in [TaskBits.decode(enc_bits)]
if b in [
BistroTaskStatusBits.DONE,
BistroTaskStatusBits.FAILED,
]
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment