From b8802cc4d70081232ecee88eedec07189dc77468 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann 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 Reviewed-by: Iustin Pop --- 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 f8f9fd8..908c674 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 c55ee88..a3c6db6 100644 --- a/man/gnt-job.sgml +++ b/man/gnt-job.sgml @@ -160,6 +160,12 @@ + priority + + current priority of the job + + + received_ts the timestamp the job was received @@ -227,6 +233,12 @@ the list of opcode end times + + oppriority + + the priority of each opcode + + diff --git a/scripts/gnt-job b/scripts/gnt-job index 8924c3e..9d58528 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) -- 1.7.10.4