Skip to content

Commit

Permalink
Merge pull request #208 from galaxyproject/207-job-wait
Browse files Browse the repository at this point in the history
Job wait
  • Loading branch information
ksuderman authored Jun 1, 2023
2 parents ae89944 + 1bc4435 commit 9d5da49
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions abm/lib/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ def show(context: Context, args: list):
print(json.dumps(job, indent=4))


def wait(context:Context, args: list):
if len(args) != 1:
print("ERROR: Invalid parameters. Job ID is required")
return
gi = connect(context)
state = "Unknown"
waiting = True
while waiting:
job = gi.jobs.show_job(args[0], full_details=False)
state = job["state"]
if state == "ok" or state == "error":
waiting = False
print(json.dumps(job, indent=4))


def get_value(metric: dict):
if metric['name'] == 'runtime_seconds':
return metric['raw_value']
Expand Down
4 changes: 4 additions & 0 deletions abm/lib/menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@
help: kills a job
handler: job.cancel
params: ID
- name: [wait]
help: Wait for a job to finish running
handler: job.wait
params: ID
- name: [ metrics, stats ]
help: display runtime metrics for the job, or a list of jobs contained in a history
handler: job.metrics
Expand Down

0 comments on commit 9d5da49

Please sign in to comment.