@@ -329,25 +329,24 @@ def get_finished_job_stats(jobid):
329329 except Exception , e :
330330 log ("Unable to read in CSV output from sacct: %s" % str (e ))
331331 return return_dict
332-
333- sacct_parser = {'RemoteUserCpu' : lambda orig , results : orig + \
334- convert_cpu_to_seconds (results ["AveCPU" ]) * int (results ["AllocCPUS" ]),
335- 'ImageSize' : lambda orig , results : orig + int (results ["MaxRSS" ].replace ('K' , '' )),
336- 'ExitCode' : lambda orig , results : int (results ["ExitCode" ].split (":" )[0 ])}
332+
337333 # Slurm can return more than 1 row, for some odd reason.
338334 # so sum up relevant values
339335 for row in reader :
340- for attr , func in sacct_parser .items ():
341- try :
342- return_dict [attr ] = func (return_dict [attr ], row )
343- except (ValueError , KeyError ), exc :
344- log ("Could not parse %s for Jobid %s: %s" % (attr , jobid , exc ))
345-
346- # PBS completion
336+ if row ["AveCPU" ] is not "" :
337+ return_dict ['RemoteUserCpu' ] += convert_cpu_to_seconds (row ["AveCPU" ]) * int (row ["AllocCPUS" ])
338+ if row ["MaxRSS" ] is not "" :
339+ # Remove the trailing 'K'
340+ return_dict ["ImageSize" ] += int (row ["MaxRSS" ].replace ('K' , '' ))
341+ if row ["ExitCode" ] is not "" :
342+ return_dict ["ExitCode" ] = int (row ["ExitCode" ].split (":" )[0 ])
343+
344+ # PBS completion
347345 elif _cluster_type_cache == "pbs" :
348346 pass
349347
350348 return return_dict
349+
351350
352351_qstat_location_cache = None
353352def get_qstat_location ():
0 commit comments