diff --git a/lib/client/gnt_job.py b/lib/client/gnt_job.py index 78eec77f798353971dc72872b6a4c5409f535642..3bdbd0d6f15df5ea93f2b0823cba52a00768c644 100644 --- a/lib/client/gnt_job.py +++ b/lib/client/gnt_job.py @@ -87,6 +87,9 @@ def ListJobs(opts, args): """ selected_fields = ParseFields(opts.output, _LIST_DEF_FIELDS) + if opts.archived and "archived" not in selected_fields: + selected_fields.append("archived") + fmtoverride = { "status": (_FormatStatus, False), "summary": (lambda value: ",".join(str(item) for item in value), False), @@ -387,12 +390,17 @@ _FINISHED_OPT = \ const=constants.JOBS_FINALIZED, help="Show finished jobs only") +_ARCHIVED_OPT = \ + cli_option("--archived", default=False, + action="store_true", dest="archived", + help="Include archived jobs in list (slow and expensive)") + commands = { "list": ( ListJobs, [ArgJobId()], [NOHDR_OPT, SEP_OPT, FIELDS_OPT, VERBOSE_OPT, FORCE_FILTER_OPT, - _PENDING_OPT, _RUNNING_OPT, _ERROR_OPT, _FINISHED_OPT], + _PENDING_OPT, _RUNNING_OPT, _ERROR_OPT, _FINISHED_OPT, _ARCHIVED_OPT], "[job_id ...]", "Lists the jobs and their status. The available fields can be shown" " using the \"list-fields\" command (see the man page for details)." diff --git a/man/gnt-job.rst b/man/gnt-job.rst index 58adc1842c0b378a363f155dcef5dd95c1cdce56..56d38174682a5d3536da1698fc7762937653db49 100644 --- a/man/gnt-job.rst +++ b/man/gnt-job.rst @@ -81,6 +81,9 @@ fields will be added to the default list. This allows one to quickly see the default list plus a few other fields, instead of retyping the entire list of fields. +To include archived jobs in the list the ``--archived`` option can be +used. + The following options can be used to show only specific jobs: ``--pending``