@@ -261,21 +261,31 @@ def get_job(jobid, user=None):
261
261
payload = {"id" : jobid , "attrs" : ["all" ]}
262
262
rpc = flux .job .list .JobListIdRPC (app .handle , "job-list.list-id" , payload )
263
263
try :
264
- jobinfo = rpc .get_job ()
264
+ jobinfo = rpc .get ()
265
265
266
266
# The job does not exist!
267
267
except FileNotFoundError :
268
268
return None
269
269
270
- # User friendly string from integer
271
- jobinfo ["state" ] = flux .job .info .statetostr (jobinfo ["state" ])
272
-
273
- # These likely appear only after completion
274
- for required in ["result" , "returncode" , "runtime" , "waitstatus" , "duration" ]:
275
- if required not in jobinfo :
276
- jobinfo [required ] = ""
270
+ jobinfo = jobinfo ["job" ]
277
271
278
- # This should be a dictionary
279
- if "exception" not in jobinfo :
280
- jobinfo ["exception" ] = {}
272
+ # User friendly string from integer
273
+ state = jobinfo ["state" ]
274
+ jobinfo ["state" ] = flux .job .info .statetostr (state )
275
+
276
+ # Get job info to add to result
277
+ info = rpc .get_jobinfo ()
278
+ jobinfo ["nnodes" ] = info ._nnodes
279
+ jobinfo ["result" ] = info .result
280
+ jobinfo ["returncode" ] = info .returncode
281
+ jobinfo ["runtime" ] = info .runtime
282
+ jobinfo ["priority" ] = info ._priority
283
+ jobinfo ["waitstatus" ] = info ._waitstatus
284
+ jobinfo ["nodelist" ] = info ._nodelist
285
+ jobinfo ["nodelist" ] = info ._nodelist
286
+ jobinfo ["exception" ] = info ._exception .__dict__
287
+
288
+ # Only appears after finished?
289
+ if "duration" not in jobinfo :
290
+ jobinfo ["duration" ] = ""
281
291
return jobinfo
0 commit comments