Skip to content

Commit c09bccd

Browse files
authored
Merge pull request #220 from trz42/bugfix/parsing_squeue_output
omit header in squeue output
2 parents 37f2891 + 448dcfa commit c09bccd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

eessi_bot_job_manager.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def get_current_jobs(self):
106106
if username is None:
107107
raise Exception("Unable to find username")
108108

109-
squeue_cmd = "%s --long --user=%s" % (self.poll_command, username)
109+
squeue_cmd = "%s --long --noheader --user=%s" % (self.poll_command, username)
110110
squeue_output, squeue_err, squeue_exitcode = run_cmd(
111111
squeue_cmd,
112112
"get_current_jobs(): squeue command",
@@ -125,10 +125,10 @@ def get_current_jobs(self):
125125
}
126126

127127
# get job info, logging any Slurm issues
128-
# Note, the first two lines of the output are skipped ("range(2,...)")
129-
# because they contain header information.
130-
for i in range(2, len(lines)):
131-
job = lines[i].rstrip().split()
128+
# Note, all output lines of squeue are processed because we run it with
129+
# --noheader.
130+
for line in lines:
131+
job = line.rstrip().split()
132132
if len(job) >= 9:
133133
job_id = job[0]
134134
state = job[4]

0 commit comments

Comments
 (0)