@@ -247,7 +247,7 @@ def get_jobs(conn):
247247 # We have to create that key and set it to something, otherwise we get errors like:
248248 # NameError("name 'resources_used_ncpus' is not defined",)
249249 attribute_names = ['resources_used_ncpus' , 'resources_used_mem' , 'resources_used_vmem' , \
250- 'resources_used_walltime' , 'exec_vnode' , 'stime' , 'etime' , 'resources_time_left' , \
250+ 'resources_used_walltime' , 'exec_host' , ' exec_vnode' , 'stime' , 'etime' , 'resources_time_left' , \
251251 'resources_used_cpupercent' ]
252252
253253 b = pbs .pbs_statjob (conn , '' , None , None )
@@ -467,17 +467,13 @@ def job_attributes_reformat(jobs):
467467 'W' :'Waiting' , 'X' :'Finished' }
468468 job ['job_state' ] = states [job ['job_state' ]]
469469
470- # Change walltimes from H:M:S to H:M
471- if job ['resource_list_walltime' ]:
472- (H ,M ,S ) = job ['resource_list_walltime' ].split (':' )
473- job ['resource_list_walltime' ] = '%s:%s' % (H ,M )
474-
475470 if job ['resources_used_walltime' ]:
476471 (H ,M ,S ) = job ['resources_used_walltime' ].split (':' )
477- job ['resources_used_walltime' ] = '%s:%s' % (H ,M )
478- hours_used = job ['resources_used_walltime' ].split (':' )[0 ]
479- hours_walltime = job ['resource_list_walltime' ].split (':' )[0 ]
480- job ['resources_time_left' ] = int (hours_walltime ) - int (hours_used )
472+ used_walltime = float (H ) + float (M )/ 60.0 + float (S )/ 3600.0
473+ (H , M , S ) = job ['resource_list_walltime' ].split (':' )
474+ list_walltime = float (H ) + float (M )/ 60.0 + float (S )/ 3600.0
475+ # TODO maybe convert this to a float with one decimal place? or raw float
476+ job ['resources_time_left' ] = int (list_walltime ) - int (used_walltime )
481477
482478 # Change memory from string in kb (eg '264501336kb') to integer Gb (eg 264).
483479 if 'resource_list_mem' in job :
0 commit comments