| @@ 374-396 (lines=23) @@ | ||
| 371 | return False |
|
| 372 | ||
| 373 | ||
| 374 | def running_stats(job_id): |
|
| 375 | stats_dict = {} |
|
| 376 | with os.popen('sacct --noheader --format Elapsed -j ' + str(job_id)) as f: |
|
| 377 | try: |
|
| 378 | line = f.readline() |
|
| 379 | new_line = re.sub(' +', ' ', line.strip()) |
|
| 380 | stats_dict['wallclock'] = get_timedelta(new_line) |
|
| 381 | except: |
|
| 382 | pass |
|
| 383 | ||
| 384 | with os.popen('sstat --noheader --format AveCPU,AveRSS,NTasks -j ' + str(job_id)) as f: |
|
| 385 | try: |
|
| 386 | line = f.readline() |
|
| 387 | new_line = re.sub(' +', ' ', line.strip()) |
|
| 388 | ntasks = int(new_line.split(' ')[2]) |
|
| 389 | stats_dict['mem'] = (float(new_line.split(' ')[1].replace('K', '')) * ntasks) |
|
| 390 | stats_dict['cpu'] = '-' # float(new_line.split(' ')[0])*ntasks |
|
| 391 | except: |
|
| 392 | pass |
|
| 393 | ||
| 394 | return stats_dict |
|
| 395 | ||
| @@ 301-321 (lines=21) @@ | ||
| 298 | return stats_dict |
|
| 299 | ||
| 300 | ||
| 301 | def running_stats(job_id): |
|
| 302 | stats_dict = {} |
|
| 303 | with os.popen('bjobs -W ' + str(job_id)) as f: |
|
| 304 | try: |
|
| 305 | line = f.readline() |
|
| 306 | new_line = re.sub(' +', ' ', line.strip()) |
|
| 307 | stats_dict['wallclock'] = new_line.split(' ')[0] |
|
| 308 | except: |
|
| 309 | pass |
|
| 310 | ||
| 311 | with os.popen('bjobs -W ' + str(job_id)) as f: |
|
| 312 | try: |
|
| 313 | line = f.readline() |
|
| 314 | new_line = re.sub(' +', ' ', line.strip()) |
|
| 315 | ntasks = int(new_line.split(' ')[2]) |
|
| 316 | stats_dict['mem'] = float(new_line.split(' ')[1]) * ntasks |
|
| 317 | stats_dict['cpu'] = float(new_line.split(' ')[0]) * ntasks |
|
| 318 | except: |
|
| 319 | pass |
|
| 320 | ||
| 321 | return stats_dict |
|
| 322 | ||