Skip to content

Commit

Permalink
Only use job_name if it is not None
Browse files Browse the repository at this point in the history
Co-authored-by: Kenneth Hoste <[email protected]>
  • Loading branch information
trz42 and boegel authored Jun 24, 2024
1 parent 1dcf081 commit 326dd38
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eessi_bot_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self):
self.logfile = job_manager_cfg.get(config.JOB_MANAGER_SETTING_LOG_PATH)
buildenv_cfg = cfg[config.SECTION_BUILDENV]
self.job_name = buildenv_cfg.get(config.BUILDENV_SETTING_JOB_NAME)
if len(self.job_name) < 3:
if self.job_name and len(self.job_name) < 3:
raise Exception(f"job name ({self.job_name}) is shorter than 3 characters")

def get_current_jobs(self):
Expand All @@ -111,7 +111,9 @@ def get_current_jobs(self):
if username is None:
raise Exception("Unable to find username")

squeue_cmd = "%s --long --noheader --user=%s --name='%s'" % (self.poll_command, username, self.job_name)
squeue_cmd = "%s --long --noheader --user=%s" % (self.poll_command, username)
if self.job_name:
squeue_cmd += "--name='%s'" % self.job_name
squeue_output, squeue_err, squeue_exitcode = run_cmd(
squeue_cmd,
"get_current_jobs(): squeue command",
Expand Down

0 comments on commit 326dd38

Please sign in to comment.