Commit 440fe644 authored by Michael Salim's avatar Michael Salim
Browse files

"balsam ls" now works for full UUID strings or

substrings not containing dashes.  It does not work
for substrings containing a dash, but this is not an expected usage.
parent 055e68c8
from balsam.service import models
import uuid
Job = models.BalsamJob
AppDef = models.ApplicationDefinition
......@@ -33,7 +34,13 @@ def print_jobs_tree(jobs):
def ls_jobs(namestr, show_history, jobid, verbose, tree, wf, state):
results = Job.objects.all()
if namestr: results = results.filter(name__icontains=namestr)
if jobid: results = results.filter(job_id__icontains=jobid)
if jobid:
pk = uuid.UUID(jobid.strip())
results = [Job.objects.get(job_id=pk)]
except ValueError:
results = results.filter(job_id__icontains=jobid)
if wf: results = results.filter(workflow__icontains=wf)
if state: results = results.filter(state=state)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment