@@ -334,25 +334,37 @@ def get_finished_job_stats(jobid):
334334 # so sum up relevant values
335335 for row in reader :
336336 if row ["AveCPU" ] is not "" :
337- return_dict ['RemoteUserCpu' ] += convert_cpu_to_seconds (row ["AveCPU" ]) * int (row ["AllocCPUS" ])
337+ try :
338+ return_dict ['RemoteUserCpu' ] += convert_cpu_to_seconds (row ["AveCPU" ]) * int (row ["AllocCPUS" ])
339+ except :
340+ log ("Failed to parse CPU usage for job id %s: %s, %s" % (jobid , row ["AveCPU" ], row ["AllocCPUS" ]))
341+ raise
338342 if row ["MaxRSS" ] is not "" :
339343 # Remove the trailing [KMGTP] and scale the value appropriately
340344 # Note: We assume that all values will have a suffix, and we
341345 # want the value in kilos.
342- value = row ["MaxRSS" ]
343- factor = 1
344- if value [- 1 ] == 'M' :
345- factor = 1024
346- elif value [- 1 ] == 'G' :
347- factor = 1024 * 1024
348- elif value [- 1 ] == 'T' :
349- factor = 1024 * 1024 * 1024
350- elif value [- 1 ] == 'P' :
351- factor = 1024 * 1024 * 1024 * 1024
352- return_dict ["ImageSize" ] += int (value .strip ('KMGTP' )) * factor
346+ try :
347+ value = row ["MaxRSS" ]
348+ factor = 1
349+ if value [- 1 ] == 'M' :
350+ factor = 1024
351+ elif value [- 1 ] == 'G' :
352+ factor = 1024 * 1024
353+ elif value [- 1 ] == 'T' :
354+ factor = 1024 * 1024 * 1024
355+ elif value [- 1 ] == 'P' :
356+ factor = 1024 * 1024 * 1024 * 1024
357+ return_dict ["ImageSize" ] += int (value .strip ('KMGTP' )) * factor
358+ except :
359+ log ("Failed to parse memory usage for job id %s: %s" % (jobid , row ["MaxRSS" ]))
360+ raise
353361 if row ["ExitCode" ] is not "" :
354- return_dict ["ExitCode" ] = int (row ["ExitCode" ].split (":" )[0 ])
355-
362+ try :
363+ return_dict ["ExitCode" ] = int (row ["ExitCode" ].split (":" )[0 ])
364+ except :
365+ log ("Failed to parse ExitCode for job id %s: %s" % (jobid , row ["ExitCode" ]))
366+ raise
367+
356368 # PBS completion
357369 elif _cluster_type_cache == "pbs" :
358370 pass
0 commit comments