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

Summarize Histories #204

Merged
merged 1 commit into from
Jun 13, 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
6 changes: 4 additions & 2 deletions abm/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,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 @@ -220,7 +221,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 @@ -312,17 +312,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)