Revision aad81f98
b/scripts/gnt-job | ||
---|---|---|
67 | 67 |
"opstatus": "OpCode_status", |
68 | 68 |
"oplog": "OpCode_log", |
69 | 69 |
"summary": "Summary", |
70 |
"opstart": "OpCode_start", |
|
71 |
"opend": "OpCode_end", |
|
72 |
"start_ts": "Start", |
|
73 |
"end_ts": "End", |
|
74 |
"received_ts": "Received", |
|
70 | 75 |
} |
71 | 76 |
else: |
72 | 77 |
headers = None |
... | ... | |
86 | 91 |
raise errors.ProgrammerError("Unknown job status code '%s'" % val) |
87 | 92 |
elif field == "summary": |
88 | 93 |
val = ",".join(val) |
94 |
elif field in ("start_ts", "end_ts", "received_ts"): |
|
95 |
val = FormatTimestamp(val) |
|
96 |
elif field in ("opstart", "opend"): |
|
97 |
val = [FormatTimestamp(entry) for entry in val] |
|
89 | 98 |
|
90 | 99 |
row[idx] = str(val) |
91 | 100 |
|
... | ... | |
131 | 140 |
else: |
132 | 141 |
return str(value) |
133 | 142 |
|
134 |
selected_fields = ["id", "status", "ops", "opresult", "opstatus", "oplog"] |
|
143 |
selected_fields = [ |
|
144 |
"id", "status", "ops", "opresult", "opstatus", "oplog", |
|
145 |
"opstart", "opend", "received_ts", "start_ts", "end_ts", |
|
146 |
] |
|
135 | 147 |
|
136 | 148 |
result = GetClient().QueryJobs(args, selected_fields) |
137 | 149 |
|
138 | 150 |
first = True |
139 | 151 |
|
140 |
for job_id, status, ops, opresult, opstatus, oplog in result:
|
|
152 |
for entry, arg_job in zip(result, args):
|
|
141 | 153 |
if not first: |
142 | 154 |
format(0, "") |
143 | 155 |
else: |
144 | 156 |
first = False |
157 |
|
|
158 |
if entry is None: |
|
159 |
format(0, "Job ID %s not found" % arg_job) |
|
160 |
continue |
|
161 |
|
|
162 |
(job_id, status, ops, opresult, opstatus, oplog, |
|
163 |
opstart, opend, recv_ts, start_ts, end_ts) = entry |
|
145 | 164 |
format(0, "Job ID: %s" % job_id) |
146 | 165 |
if status in _USER_JOB_STATUS: |
147 | 166 |
status = _USER_JOB_STATUS[status] |
... | ... | |
149 | 168 |
raise errors.ProgrammerError("Unknown job status code '%s'" % val) |
150 | 169 |
|
151 | 170 |
format(1, "Status: %s" % status) |
171 |
|
|
172 |
if recv_ts is not None: |
|
173 |
format(1, "Received: %s" % FormatTimestamp(recv_ts)) |
|
174 |
else: |
|
175 |
format(1, "Missing received timestamp (%s)" % str(recv_ts)) |
|
176 |
|
|
177 |
if start_ts is not None: |
|
178 |
if recv_ts is not None: |
|
179 |
d1 = start_ts[0] - recv_ts[0] + (start_ts[1] - recv_ts[1]) / 1000000.0 |
|
180 |
delta = " (delta %.6fs)" % d1 |
|
181 |
else: |
|
182 |
delta = "" |
|
183 |
format(1, "Processing start: %s%s" % (FormatTimestamp(start_ts), delta)) |
|
184 |
else: |
|
185 |
format(1, "Processing start: unknown (%s)" % str(start_ts)) |
|
186 |
|
|
187 |
if end_ts is not None: |
|
188 |
if start_ts is not None: |
|
189 |
d2 = end_ts[0] - start_ts[0] + (end_ts[1] - start_ts[1]) / 1000000.0 |
|
190 |
delta = " (delta %.6fs)" % d2 |
|
191 |
else: |
|
192 |
delta = "" |
|
193 |
format(1, "Processing end: %s%s" % (FormatTimestamp(end_ts), delta)) |
|
194 |
else: |
|
195 |
format(1, "Processing end: unknown (%s)" % str(end_ts)) |
|
196 |
|
|
197 |
if end_ts is not None and recv_ts is not None: |
|
198 |
d3 = end_ts[0] - recv_ts[0] + (end_ts[1] - recv_ts[1]) / 1000000.0 |
|
199 |
format(1, "Total processing time: %.6f seconds" % d3) |
|
200 |
else: |
|
201 |
format(1, "Total processing time: N/A") |
|
152 | 202 |
format(1, "Opcodes:") |
153 |
for opcode, result, status, log in zip(ops, opresult, opstatus, oplog): |
|
203 |
for (opcode, result, status, log, s_ts, e_ts) in \ |
|
204 |
zip(ops, opresult, opstatus, oplog, opstart, opend): |
|
154 | 205 |
format(2, "%s" % opcode["OP_ID"]) |
155 | 206 |
format(3, "Status: %s" % status) |
207 |
if isinstance(s_ts, (tuple, list)): |
|
208 |
format(3, "Processing start: %s" % FormatTimestamp(s_ts)) |
|
209 |
else: |
|
210 |
format(3, "No processing start time") |
|
211 |
if isinstance(e_ts, (tuple, list)): |
|
212 |
format(3, "Processing end: %s" % FormatTimestamp(e_ts)) |
|
213 |
else: |
|
214 |
format(3, "No processing end time") |
|
156 | 215 |
format(3, "Input fields:") |
157 | 216 |
for key, val in opcode.iteritems(): |
158 | 217 |
if key == "OP_ID": |
Also available in: Unified diff