This repository was archived by the owner on Oct 10, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,8 +336,20 @@ def get_finished_job_stats(jobid):
336336 if row ["AveCPU" ] is not "" :
337337 return_dict ['RemoteUserCpu' ] += convert_cpu_to_seconds (row ["AveCPU" ]) * int (row ["AllocCPUS" ])
338338 if row ["MaxRSS" ] is not "" :
339- # Remove the trailing 'K'
340- return_dict ["ImageSize" ] += int (row ["MaxRSS" ].replace ('K' , '' ))
339+ # Remove the trailing [KMGTP] and scale the value appropriately
340+ # Note: We assume that all values will have a suffix, and we
341+ # 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
341353 if row ["ExitCode" ] is not "" :
342354 return_dict ["ExitCode" ] = int (row ["ExitCode" ].split (":" )[0 ])
343355
Original file line number Diff line number Diff line change @@ -325,8 +325,20 @@ def get_finished_job_stats(jobid):
325325 if row ["AveCPU" ] is not "" :
326326 return_dict ['RemoteUserCpu' ] += convert_cpu_to_seconds (row ["AveCPU" ]) * int (row ["AllocCPUS" ])
327327 if row ["MaxRSS" ] is not "" :
328- # Remove the trailing 'K'
329- return_dict ["ImageSize" ] += int (row ["MaxRSS" ].replace ('K' , '' ))
328+ # Remove the trailing [KMGTP] and scale the value appropriately
329+ # Note: We assume that all values will have a suffix, and we
330+ # want the value in kilos.
331+ value = row ["MaxRSS" ]
332+ factor = 1
333+ if value [- 1 ] == 'M' :
334+ factor = 1024
335+ elif value [- 1 ] == 'G' :
336+ factor = 1024 * 1024
337+ elif value [- 1 ] == 'T' :
338+ factor = 1024 * 1024 * 1024
339+ elif value [- 1 ] == 'P' :
340+ factor = 1024 * 1024 * 1024 * 1024
341+ return_dict ["ImageSize" ] += int (value .strip ('KMGTP' )) * factor
330342 if row ["ExitCode" ] is not "" :
331343 return_dict ["ExitCode" ] = int (row ["ExitCode" ].split (":" )[0 ])
332344
You can’t perform that action at this time.
0 commit comments