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

History name #265

Merged
merged 1 commit into from
Dec 15, 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
17 changes: 15 additions & 2 deletions abm/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,18 @@ def print_table_header():
print(','.join(table_header))


history_name_cache = dict()
def get_history_name(gi, hid: str) -> str:
if hid in history_name_cache:
return history_name_cache[hid]
history = gi.histories.show_history(hid)
if history is None:
return 'unknown'
name = history['name']
history_name_cache[hid] = name
return name


def summarize_metrics(gi, jobs: list):
table = []
# table.append(header)
Expand All @@ -237,8 +249,9 @@ def summarize_metrics(gi, jobs: list):
toolid = f'{parts[-2]}/{parts[-1]}'
metrics = metrics_to_dict(job_metrics, table_header)
metrics['id'] = job.get('id', 'unknown')
metrics['history_id'] = job.get('history_id', 'unknown')
metrics['history_name'] = job.get('history_name', 'unknown')
hid = job.get('history_id', 'unknown')
metrics['history_id'] = hid
metrics['history_name'] = get_history_name(gi, hid)
metrics['state'] = job.get('state', 'unknown')
metrics['tool_id'] = toolid
metrics['invocation_id'] = job.get('invocation_id', 'unknown')
Expand Down
2 changes: 1 addition & 1 deletion abm/lib/invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def summarize(context: Context, args: list):
parser.add_argument('-s', '--sort-by', choices=['runtime', 'memory', 'tool'])
argv = parser.parse_args(args)
gi = connect(context)
id = args[0]
id = argv.id[0]
all_jobs = []
jobs = gi.jobs.get_jobs(invocation_id=id)
for job in jobs:
Expand Down