[Webservice] Fix splitting squeue output when hostname is missing
Description
str.split()
with no argument splits on any run of whitespace and strips trailing spaces. This means that if there's no hostname in the output from squeue
, e.g. for a pending job, split produces 3 values and then unpacking fails (silently). The job monitor then falls back to calling sacct
, but new jobs may not be in the accounting database yet, so it gets treated as a finished & failed job.
Splitting on a space explicitly preserves the hostname field as an empty string.
How Has This Been Tested?
With a value from the logs, after the log call was hotfixed in.
In [1]: '11846333 PENDING 0:00 '.split()
Out[1]: ['11846333', 'PENDING', '0:00']
In [2]: '11846333 PENDING 0:00 '.split(' ')
Out[2]: ['11846333', 'PENDING', '0:00', '']
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
- My code follows the code style of this project.