Commit eba1aaad authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

gnt-job info: Convert to query2

Otherwise detecting unavailable jobs is hard (“status” is None, is this
an error or just an unavailable job?).
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent e07f7f7a
......@@ -218,27 +218,26 @@ def ShowJobs(opts, args):
"opstart", "opexec", "opend", "received_ts", "start_ts", "end_ts",
result = GetClient().QueryJobs(args, selected_fields)
result = GetClient().Query(constants.QR_JOB, selected_fields,
qlang.MakeSimpleFilter("id", args)).data
first = True
for idx, entry in enumerate(result):
for entry in result:
if not first:
format_msg(0, "")
first = False
if entry is None:
if idx <= len(args):
format_msg(0, "Job ID %s not found" % args[idx])
# this should not happen, when we don't pass args it will be a
# valid job returned
format_msg(0, "Job ID requested as argument %s not found" % (idx + 1))
((_, job_id), (rs_status, status), (_, ops), (_, opresult), (_, opstatus),
(_, oplog), (_, opstart), (_, opexec), (_, opend), (_, recv_ts),
(_, start_ts), (_, end_ts)) = entry
# Detect non-normal results
if rs_status != constants.RS_NORMAL:
format_msg(0, "Job ID %s not found" % job_id)
(job_id, status, ops, opresult, opstatus, oplog,
opstart, opexec, opend, recv_ts, start_ts, end_ts) = entry
format_msg(0, "Job ID: %s" % job_id)
if status in _USER_JOB_STATUS:
status = _USER_JOB_STATUS[status]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment