Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add listing job metrics for all jobs in a history #185

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions abm/lib/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,30 @@ def metrics(context: Context, args: list):
print("ERROR: no job ID provided")
return
gi = connect(context)
metrics = gi.jobs.get_metrics(args[0])
if len(args) > 1:
arg = args.pop(0)
if arg in ['-h', '--history']:
history_id = args.pop(0)
log.debug(f"Getting metrics for jobs from history {history_id}")
job_list = gi.jobs.get_jobs(history_id=history_id)
metrics = []
for job in job_list:
metrics.append({
'job_id': job['id'],
'job_state': job['state'],
'tool_id': job['tool_id'],
'job_metrics': gi.jobs.get_metrics(job['id'])
})
else:
print(f"ERROR: Unrecognized argument {arg}")
else:
job = gi.jobs.show_job(args[0])
metrics = [{
'job_id': job['id'],
'job_state': job['state'],
'tool_id': job['tool_id'],
'job_metrics': gi.jobs.get_metrics(args[0])
}]
print(json.dumps(metrics, indent=4))
# metrics = {}
# for m in gi.jobs.get_metrics(args[0]):
Expand All @@ -78,4 +101,4 @@ def problems(context: Context, args: list):
print('ERROR: no job ID provided.')
return
gi = connect(context)
pprint(gi.jobs.get_common_problems(args[0]))
pprint(gi.jobs.get_common_problems(args[0]))
6 changes: 3 additions & 3 deletions abm/lib/menu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name:
- name:
- benchmark
- bench
help: 'manage benchmarks'
Expand Down Expand Up @@ -174,9 +174,9 @@
handler: job.cancel
params: ID
- name: [ metrics, stats ]
help: display runtime metrics for the job
help: display runtime metrics for the job, or a list of jobs contained in a history
handler: job.metrics
params: ID
params: "[ID | -h|--history historyID]"
- name: [users, user]
help: manage users on the Galaxy instance
menu:
Expand Down