Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for job manager crash: Unable to contact slurm controller #255

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions eessi_bot_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,15 @@ def get_current_jobs(self):
squeue_cmd,
"get_current_jobs(): squeue command",
log_file=self.logfile,
raise_on_error=False,
laraPPr marked this conversation as resolved.
Show resolved Hide resolved
)

if squeue_exitcode != 0:
current_jobs = {}
laraPPr marked this conversation as resolved.
Show resolved Hide resolved
laraPPr marked this conversation as resolved.
Show resolved Hide resolved
poll_interval = config.read_config()["job_manager"].get("poll_interval")
log("The squeue command failed will try again in {} seconds".format(poll_interval))
return current_jobs

laraPPr marked this conversation as resolved.
Show resolved Hide resolved
# create dictionary of jobs from output of 'squeue_cmd'
# with the following information per job: jobid, state,
# nodelist_reason
Expand Down Expand Up @@ -667,14 +674,26 @@ def main():
if max_iter != 0:
known_jobs = job_manager.get_known_jobs()
while max_iter < 0 or i < max_iter:
# sleep poll_interval seconds (not for the first iteration)
if i != 0 and (max_iter < 0 or i < max_iter):
laraPPr marked this conversation as resolved.
Show resolved Hide resolved
log(
"job manager main loop: sleep %d seconds" % poll_interval,
job_manager.logfile,
)
time.sleep(poll_interval)
log("job manager main loop: iteration %d" % i, job_manager.logfile)
log(
"job manager main loop: known_jobs='%s'" % ",".join(
known_jobs.keys()),
job_manager.logfile,
)

current_jobs = job_manager.get_current_jobs()
try:
current_jobs = job_manager.get_current_jobs()
except:
laraPPr marked this conversation as resolved.
Show resolved Hide resolved
i = i + 1
continue

log(
"job manager main loop: current_jobs='%s'" % ",".join(
current_jobs.keys()),
Expand Down Expand Up @@ -729,13 +748,7 @@ def main():

known_jobs = current_jobs

# sleep poll_interval seconds (only if at least one more iteration)
if max_iter < 0 or i + 1 < max_iter:
log(
"job manager main loop: sleep %d seconds" % poll_interval,
job_manager.logfile,
)
time.sleep(poll_interval)
# add one iteration to the loop
i = i + 1


Expand Down
Loading