Skip to content

Commit

Permalink
Merge pull request #265 from galaxyproject/257-history-name
Browse files Browse the repository at this point in the history
History name
  • Loading branch information
ksuderman authored Dec 15, 2023
2 parents dac22bc + 24e327a commit 7b1a3c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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

0 comments on commit 7b1a3c9

Please sign in to comment.