From 4f74ad06fb75f2dddc32c742d70e8b8e1a38b66b Mon Sep 17 00:00:00 2001 From: Brian Christiansen <brian@schedmd.com> Date: Thu, 5 Jan 2017 07:52:47 -0700 Subject: [PATCH] Requeue completing jobs in db If a job was requeued while in the completing state, the database wasn't being updated with the requeue state. --- src/slurmctld/job_mgr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 0acf463fe81..d0a5cc12e4b 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -14277,7 +14277,9 @@ static int _job_requeue(uid_t uid, struct job_record *job_ptr, bool preempt, uint32_t state) { bool is_running = false, is_suspended = false, is_completed = false; + bool is_completing = false; time_t now = time(NULL); + uint32_t completing_flags; /* validate the request */ if ((uid != job_ptr->user_id) && !validate_operator(uid) && @@ -14321,10 +14323,8 @@ static int _job_requeue(uid_t uid, struct job_record *job_ptr, bool preempt, * of done/exit/exiting jobs. */ if (IS_JOB_COMPLETING(job_ptr)) { - uint32_t flags; - flags = job_ptr->job_state & JOB_STATE_FLAGS; - job_ptr->job_state = JOB_PENDING | flags; - goto reply; + completing_flags = job_ptr->job_state & JOB_STATE_FLAGS; + is_completing = true; } if (IS_JOB_SUSPENDED(job_ptr)) { @@ -14341,7 +14341,7 @@ static int _job_requeue(uid_t uid, struct job_record *job_ptr, bool preempt, job_ptr->time_last_active = now; if (is_suspended) job_ptr->end_time = job_ptr->suspend_time; - else + else if (!is_completing) job_ptr->end_time = now; /* Save the state of the job so that @@ -14360,6 +14360,11 @@ static int _job_requeue(uid_t uid, struct job_record *job_ptr, bool preempt, build_cg_bitmap(job_ptr); job_completion_logger(job_ptr, true); + if (is_completing) { + job_ptr->job_state = JOB_PENDING | completing_flags; + goto reply; + } + /* Deallocate resources only if the job has some. * JOB_COMPLETING is needed to properly clean up steps. */ if (is_running) { -- GitLab