Skip to content

Commit

Permalink
[lib/job_handling] fix filter ...in_ stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
augu5te committed Sep 9, 2024
1 parent 78e11cf commit c6c84f5
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions oar/lib/job_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,25 @@ def get_current_jobs_dependencies(session, jobs):
def get_current_not_waiting_jobs(
session,
):
jobs = session.query(Job).filter(Job.state in ('Hold','toLaunch','toError','toAckReservation','Launching','Running','Suspended','Resuming','Finishing')).all()
jobs = (
session.query(Job)
.filter(
Job.state.in_(
(
"Hold",
"toLaunch",
"toError",
"toAckReservation",
"Launching",
"Running",
"Suspended",
"Resuming",
"Finishing",
)
)
)
.all()
)
jobs_by_state = {}
for job in jobs:
if job.state not in jobs_by_state:
Expand Down Expand Up @@ -1976,18 +1994,20 @@ def get_job_cpuset_name(session, job_id, job=None):

return user + "_" + str(job_id)


def convert_status_code(code):
if code is None:
return None

exit_value = code >> 8
exit_kill = code & 127

if exit_value != 0 :
if exit_value != 0:
return exit_value
else :
else:
return exit_kill


def get_job_exit_status_code(session, job_id, job=None):
"""Get the converted exit code for the given job"""
if job is None:
Expand All @@ -1998,6 +2018,7 @@ def get_job_exit_status_code(session, job_id, job=None):

return convert_status_code(code)


def job_fragged(session, job_id):
"""Set the flag 'ToFrag' of a job to 'No'"""
session.query(FragJob).filter(FragJob.job_id == job_id).update(
Expand Down

0 comments on commit c6c84f5

Please sign in to comment.