From b8802cc4d70081232ecee88eedec07189dc77468 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 8 Oct 2010 15:59:30 +0200 Subject: [PATCH] jqueue/gnt-job: Add job priority fields for display These fields can help with debugging. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/jqueue.py | 4 ++++ man/gnt-job.sgml | 12 ++++++++++++ scripts/gnt-job | 7 ++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/jqueue.py b/lib/jqueue.py index f8f9fd872..908c6741c 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -376,6 +376,8 @@ class _QueuedJob(object): row.append(self.id) elif fname == "status": row.append(self.CalcStatus()) + elif fname == "priority": + row.append(self.CalcPriority()) elif fname == "ops": row.append([op.input.__getstate__() for op in self.ops]) elif fname == "opresult": @@ -390,6 +392,8 @@ class _QueuedJob(object): row.append([op.exec_timestamp for op in self.ops]) elif fname == "opend": row.append([op.end_timestamp for op in self.ops]) + elif fname == "oppriority": + row.append([op.priority for op in self.ops]) elif fname == "received_ts": row.append(self.received_timestamp) elif fname == "start_ts": diff --git a/man/gnt-job.sgml b/man/gnt-job.sgml index c55ee889e..a3c6db693 100644 --- a/man/gnt-job.sgml +++ b/man/gnt-job.sgml @@ -159,6 +159,12 @@ <simpara>the status of the job</simpara> </listitem> </varlistentry> + <varlistentry> + <term>priority</term> + <listitem> + <simpara>current priority of the job</simpara> + </listitem> + </varlistentry> <varlistentry> <term>received_ts</term> <listitem> @@ -227,6 +233,12 @@ <simpara>the list of opcode end times</simpara> </listitem> </varlistentry> + <varlistentry> + <term>oppriority</term> + <listitem> + <simpara>the priority of each opcode</simpara> + </listitem> + </varlistentry> </variablelist> </para> diff --git a/scripts/gnt-job b/scripts/gnt-job index 8924c3edd..9d5852870 100755 --- a/scripts/gnt-job +++ b/scripts/gnt-job @@ -69,6 +69,7 @@ def ListJobs(opts, args): headers = { "id": "ID", "status": "Status", + "priority": "Prio", "ops": "OpCodes", "opresult": "OpCode_result", "opstatus": "OpCode_status", @@ -77,6 +78,7 @@ def ListJobs(opts, args): "opstart": "OpCode_start", "opexec": "OpCode_exec", "opend": "OpCode_end", + "oppriority": "OpCode_prio", "start_ts": "Start", "end_ts": "End", "received_ts": "Received", @@ -84,6 +86,8 @@ def ListJobs(opts, args): else: headers = None + numfields = ["priority"] + # change raw values to nicer strings for row_id, row in enumerate(output): if row is None: @@ -107,7 +111,8 @@ def ListJobs(opts, args): row[idx] = str(val) data = GenerateTable(separator=opts.separator, headers=headers, - fields=selected_fields, data=output) + fields=selected_fields, data=output, + numfields=numfields) for line in data: ToStdout(line) -- GitLab