From 8a057278a79183da08a45c4dd0893ef714866cd9 Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Wed, 22 Jan 2014 16:34:57 -0500 Subject: [PATCH] Add job-list to CLI Change-Id: I6c79027c9a6513b1f4ec7824e8d5de0695f08374 Implements: blueprint python-savannaclient-cli --- savannaclient/api/shell.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/savannaclient/api/shell.py b/savannaclient/api/shell.py index 665de14e..28334228 100644 --- a/savannaclient/api/shell.py +++ b/savannaclient/api/shell.py @@ -580,3 +580,31 @@ def do_job_template_delete(cs, args): """Delete a job template.""" cs.jobs.delete(args.id) # TODO(mattf): No indication of result + + +# +# Job Executions +# ~~~~~~~~~~~~~~ +# job-list +# +# TODO(mattf): job-show --name |--id +# +# TODO(mattf): job-create --name --job-template +# --input-data +# --output-data +# --cluster-template +# NB: Optional job_configs +# NB: POST /jobs/{job_template_id}/execute +# +# TODO(mattf): job-delete --name |--id +# + +def do_job_list(cs, args): + """Print a list of jobs.""" + jobs = cs.job_executions.list() + for job in jobs: + # why is status in info.status? + job.status = job.info['status'] + # TODO(mattf): why can cluster_id be None? + columns = ('id', 'cluster_id', 'status') + utils.print_list(jobs, columns)