Skip to content

Commit

Permalink
Merge pull request #204 from galaxyproject/201-summarize-histories
Browse files Browse the repository at this point in the history
Summarize Histories
  • Loading branch information
ksuderman authored Jun 13, 2023
2 parents 9b79c89 + dc993df commit 1dda8ea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
6 changes: 4 additions & 2 deletions abm/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def find_executable(name):
def summarize_metrics(gi, jobs: list):
header= [
"id",
"history",
"history_id",
"history_name",
"state",
"tool_id",
"invocation_id",
Expand Down Expand Up @@ -222,7 +223,8 @@ def summarize_metrics(gi, jobs: list):
row = []
metrics = metrics_to_dict(job_metrics, header)
metrics['id'] = job['id']
metrics['history'] = job['history_id']
metrics['history_id'] = job['history_id']
metrics['history_name'] = job['history_name']
metrics['state'] = job['state']
metrics['tool_id'] = job['tool_id']
metrics['invocation_id'] = job['invocation_id']
Expand Down
28 changes: 20 additions & 8 deletions abm/lib/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,29 @@ def summarize(context: Context, args: list):
print("ERROR: Provide one or more history ID values.")
return
gi = connect(context)
hid = args[0]
all_jobs = []
invocations = gi.invocations.get_invocations(history_id=hid)
for invocation in invocations:
id = invocation['id']
jobs = gi.jobs.get_jobs(history_id=hid, invocation_id=id)
while len(args) > 0:
hid = args.pop(0)
history = gi.histories.show_history(history_id=hid)
jobs = gi.jobs.get_jobs(history_id=hid)
for job in jobs:
job['invocation_id'] = id
job['invocation_id'] = ''
job['history_id'] = hid
if 'workflow_id' in invocation:
job['workflow_id'] = invocation['workflow_id']
job['history_name'] = history['name']
job['workflow_id'] = ''
# if 'workflow_id' in invocation:
# job['workflow_id'] = invocation['workflow_id']
all_jobs.append(job)
# invocations = gi.invocations.get_invocations(history_id=hid)
# for invocation in invocations:
# id = invocation['id']
# #jobs = gi.jobs.get_jobs(history_id=hid, invocation_id=id)
# jobs = gi.jobs.get_jobs(history_id=hid)
# for job in jobs:
# job['invocation_id'] = id
# job['history_id'] = hid
# if 'workflow_id' in invocation:
# job['workflow_id'] = invocation['workflow_id']
# all_jobs.append(job)
# summarize_metrics(gi, gi.jobs.get_jobs(history_id=args[0]))
summarize_metrics(gi, all_jobs)

0 comments on commit 1dda8ea

Please sign in to comment.