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

Allow filtering of jobs by history #184

Merged
merged 1 commit into from
Apr 25, 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
9 changes: 6 additions & 3 deletions abm/lib/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

def list(context: Context, args: list):
state = ''
history_id = None
log.debug('Processing args')
log_state = False
while len(args) > 0:
Expand All @@ -18,14 +19,16 @@ def list(context: Context, args: list):
return
state = args.pop(0)
log_state = True

elif arg in ['-h', '--history']:
history_id = args.pop(0)
log.debug(f"Getting jobs from history {history_id}")
log.debug('Connecting to the Galaxy server')
gi = connect(context)
if log_state:
log.debug(f"Getting jobs with state {state}")
else:
log.debug("Getting job list")
job_list = gi.jobs.get_jobs(state=state)
job_list = gi.jobs.get_jobs(state=state, history_id=history_id)
log.debug(f"Iterating over job list with {len(job_list)} items")
for job in job_list:
print(f"{job['id']}\t{job['state']}\t{job['update_time']}\t{job['tool_id']}")
Expand Down Expand Up @@ -78,4 +81,4 @@ def problems(context: Context, args: list):
print('ERROR: no job ID provided.')
return
gi = connect(context)
pprint(gi.jobs.get_common_problems(args[0]))
pprint(gi.jobs.get_common_problems(args[0]))
6 changes: 3 additions & 3 deletions abm/lib/menu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name:
- name:
- benchmark
- bench
help: 'manage benchmarks'
Expand Down Expand Up @@ -158,9 +158,9 @@
help: manage jobs on the server
menu:
- name: [ list, ls ]
help: list all jobs, or jobs in a particular state
help: list all jobs, or jobs in a particular state. Can filter by a history.
handler: job.list
params: "[-s|--state ok|running|error|waiting]"
params: "[-s|--state ok|running|error|waiting] [-h|--history_id historyID]"
- name: [ show ]
help: show detailed information about a job
handler: job.show
Expand Down