troycomi / reportseff

Tabular seff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZeroDivisionError: division by zero when AllocCPUS is 0

ttys42 opened this issue · comments

In job.py line 146 there is a division by the value of a variable that can be 0. I'm not exactly sure why AllocCPUS is 0 for a few jobs at our cluster but a division by zero should be handled.

    145         cpus = (
    146             _parse_slurm_timedelta(entry["TotalCPU"]) / int(entry["AllocCPUS"])
    147             if "TotalCPU" in entry and "AllocCPUS" in entry
    148             else 0
    149         )

Error processing entry: {'AdminComment': '', 'AllocCPUS': '0', 'Elapsed': '00:00:00', 'JobID': '', 'JobIDRaw': '', 'MaxRSS': '', 'NNodes': '1', 'REQMEM': '64G', 'State': 'CANCELLED by ', 'Timelimit': '14-12:00:00', 'TotalCPU': '00:00:00'}
Traceback (most recent call last):
...
File "/.local/lib/python3.6/site-packages/reportseff/job.py", line 147, in _update_main_job
if "TotalCPU" in entry and "AllocCPUS" in entry
ZeroDivisionError: division by zero

OK forget it. It seems that my pip installed a very old version of reportseff. The latest version does not have any problem.

Yes, I was going to also reference #47 which had the same problem.