From 5b23c34c348f16a4b8c39e1ae43b8e1dd4a28f9c Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 29 Sep 2008 15:38:40 +0000
Subject: [PATCH] Add opcode execution log in job info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch adds the job execution log in βgnt-job infoβ and also allows
its selection in βgnt-job listβ (however here it's not very useful as
it's not easy to parse). It does this by adding a new field in the query
job call, named βoplogβ.
With this, one can get a very clear examination of the job. What remains
to be added would be timestamps for start/stop of the processing for the
job itself and its opcodes.
Reviewed-by: imsnah
---
lib/jqueue.py | 2 ++
scripts/gnt-job | 13 ++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/jqueue.py b/lib/jqueue.py
index 2ae424cd7..ee9ee3c7a 100644
--- a/lib/jqueue.py
+++ b/lib/jqueue.py
@@ -696,6 +696,8 @@ class JobQueue(object):
row.append([op.result for op in job.ops])
elif fname == "opstatus":
row.append([op.status for op in job.ops])
+ elif fname == "oplog":
+ row.append([op.log for op in job.ops])
elif fname == "summary":
row.append([op.input.Summary() for op in job.ops])
else:
diff --git a/scripts/gnt-job b/scripts/gnt-job
index 6b0a56d21..a29fa2108 100755
--- a/scripts/gnt-job
+++ b/scripts/gnt-job
@@ -22,6 +22,7 @@
import sys
import os
import itertools
+import time
from optparse import make_option
from cStringIO import StringIO
@@ -64,6 +65,7 @@ def ListJobs(opts, args):
"ops": "OpCodes",
"opresult": "OpCode_result",
"opstatus": "OpCode_status",
+ "oplog": "OpCode_log",
"summary": "Summary",
}
else:
@@ -129,13 +131,13 @@ def ShowJobs(opts, args):
else:
return str(value)
- selected_fields = ["id", "status", "ops", "opresult", "opstatus"]
+ selected_fields = ["id", "status", "ops", "opresult", "opstatus", "oplog"]
result = GetClient().QueryJobs(args, selected_fields)
first = True
- for job_id, status, ops, opresult, opstatus in result:
+ for job_id, status, ops, opresult, opstatus, oplog in result:
if not first:
format(0, "")
else:
@@ -148,7 +150,7 @@ def ShowJobs(opts, args):
format(1, "Status: %s" % status)
format(1, "Opcodes:")
- for opcode, result, status in zip(ops, opresult, opstatus):
+ for opcode, result, status, log in zip(ops, opresult, opstatus, oplog):
format(2, "%s" % opcode["OP_ID"])
format(3, "Status: %s" % status)
format(3, "Input fields:")
@@ -175,6 +177,11 @@ def ShowJobs(opts, args):
format(4, "%s: %s" % (key, result_helper(val)))
else:
format(3, "Result: %s" % result)
+ format(3, "Execution log:")
+ for serial, (sec, usec), log_type, log_msg in log:
+ time_txt = time.strftime("%F %T", time.localtime(sec)) + ".%06d" % usec
+ encoded = str(log_msg).encode('string_escape')
+ format(4, "%s:%s:%s %s" % (serial, time_txt, log_type, encoded))
return 0
--
GitLab