Skip to content

Commit 84a303b

Browse files
authored
Merge pull request #200 from galaxyproject/dev
Release 2.5.0
2 parents fdba951 + d836b56 commit 84a303b

6 files changed

Lines changed: 62 additions & 6 deletions

File tree

abm/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.0
1+
2.5.0

abm/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# These imports are required because we need Python to be load them to the
1919
# symbol table so the parse_menu method can find them in globals()
20-
from lib import job, dataset, workflow, history, library, folder, benchmark, helm, kubectl, config, experiment, users, cloudlaunch
20+
from lib import job, dataset, workflow, history, library, folder, benchmark, helm, kubectl, config, experiment, users, cloudlaunch, invocation
2121

2222
log = logging.getLogger('abm')
2323
handler = logging.StreamHandler()

abm/lib/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ def summarize_metrics(gi, jobs: list):
200200
"galaxy_slots",
201201
# "memory.failcnt",
202202
"memory.limit_in_bytes",
203-
# "memory.max_usage_in_bytes",
203+
"memory.max_usage_in_bytes",
204204
# "memory.memsw.limit_in_bytes",
205205
# "memory.memsw.max_usage_in_bytes",
206206
# "memory.oom_control.oom_kill_disable",
207207
# "memory.oom_control.under_oom",
208-
# "memory.soft_limit_in_bytes",
208+
"memory.soft_limit_in_bytes",
209209
"memtotal",
210210
"processor_count",
211211
"runtime_seconds",

abm/lib/invocation.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from common import Context, connect, summarize_metrics, print_json
2+
3+
def doList(context: Context, args: list):
4+
wid = None
5+
hid = None
6+
while len(args) > 0:
7+
arg = args.pop(0)
8+
if args in ['-h', '--history']:
9+
hid = args.pop(0)
10+
elif arg in ['-w', '--workflow']:
11+
wid = args.pop(0)
12+
else:
13+
print(f'Invalid parameter: {arg}')
14+
return
15+
gi = connect(context)
16+
invocations = gi.invocations.get_invocations(workflow_id=wid, history_id=hid)
17+
print('ID\tState\tWorkflow\tHistory')
18+
for invocation in invocations:
19+
id = invocation['id']
20+
state = invocation['state']
21+
workflow = invocation['workflow_id']
22+
history = invocation['history_id']
23+
print(f'{id}\t{state}\t{workflow}\t{history}')
24+
25+
26+
def summarize(context: Context, args: list):
27+
if len(args) == 0:
28+
print("ERROR: Provide one or more invocation ID values.")
29+
return
30+
gi = connect(context)
31+
id = args[0]
32+
all_jobs = []
33+
jobs = gi.jobs.get_jobs(invocation_id=id)
34+
for job in jobs:
35+
job['invocation_id'] = id
36+
job['workflow_id'] = ''
37+
all_jobs.append(job)
38+
summarize_metrics(gi, all_jobs)

abm/lib/menu.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@
243243
help: playground code
244244
handler: experiment.test
245245
params: [VARIES]
246+
- name: [invocation, inv, invocations]
247+
help: get information about job and workflow invocations
248+
menu:
249+
- name: [list, ls]
250+
help: list all invocations.
251+
handler: invocation.doList
252+
params: "[-w|--workflow ID] [-h|--history ID]"
253+
- name: [summarize]
254+
help: generate a CSV of job metrics for an invocation
255+
params: ID
256+
handler: invocation.summarize
246257
- name: [helm]
247258
help: execute a helm command
248259
menu:

abm/lib/workflow.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,15 @@ def invocation(context:Context, args:list):
182182
# return
183183
gi = connect(context)
184184
# result = gi.workflows.show_invocation(workflow_id, invocation_id)
185-
result = gi.invocations.get_invocations(workflow_id=workflow_id, view='element', step_details=True)
186-
print(json.dumps(result, indent=4))
185+
invocations = gi.invocations.get_invocations(workflow_id=workflow_id, view='element', step_details=True)
186+
# print(json.dumps(result, indent=4))
187+
print('ID\tState\tWorkflow\tHistory')
188+
for invocation in invocations:
189+
id = invocation['id']
190+
state = invocation['state']
191+
workflow = invocation['workflow_id']
192+
history = invocation['history_id']
193+
print(f'{id}\t{state}\t{workflow}\t{history}')
187194

188195

189196
def find(context: Context, args: list):

0 commit comments

Comments
 (0)