From 1d612626976dacbbdf4eeaf23ebb0a9a40a7f89e Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 14 Jul 2003 18:05:38 +0000 Subject: [PATCH] If job_complete arrives while job is pending then set is start_time and end_time to zero (previously was just setting the end_time so it looked like the job ran for a huge time interval). --- src/slurmctld/job_mgr.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index e4142887dad..b2327585b9e 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -1093,6 +1093,7 @@ int job_allocate(job_desc_msg_t * job_specs, uint32_t * new_job_id, if (error_code) { if (immediate && job_ptr) { job_ptr->job_state = JOB_FAILED; + job_ptr->start_time = 0; job_ptr->end_time = 0; } return error_code; @@ -1103,8 +1104,9 @@ int job_allocate(job_desc_msg_t * job_specs, uint32_t * new_job_id, top_prio = _top_priority(job_ptr); if (immediate && (!top_prio)) { - job_ptr->job_state = JOB_FAILED; - job_ptr->end_time = 0; + job_ptr->job_state = JOB_FAILED; + job_ptr->start_time = 0; + job_ptr->end_time = 0; return ESLURM_NOT_TOP_PRIORITY; } @@ -1132,8 +1134,9 @@ int job_allocate(job_desc_msg_t * job_specs, uint32_t * new_job_id, (error_code == ESLURM_REQUESTED_PART_CONFIG_UNAVAILABLE)) { /* Not fatal error, but job can't be scheduled right now */ if (immediate) { - job_ptr->job_state = JOB_FAILED; - job_ptr->end_time = 0; + job_ptr->job_state = JOB_FAILED; + job_ptr->start_time = 0; + job_ptr->end_time = 0; } else /* job remains queued */ if (error_code == ESLURM_NODES_BUSY) error_code = SLURM_SUCCESS; @@ -1141,14 +1144,16 @@ int job_allocate(job_desc_msg_t * job_specs, uint32_t * new_job_id, } if (error_code) { /* fundamental flaw in job request */ - job_ptr->job_state = JOB_FAILED; - job_ptr->end_time = 0; + job_ptr->job_state = JOB_FAILED; + job_ptr->start_time = 0; + job_ptr->end_time = 0; return error_code; } if (will_run) { /* job would run, flag job destruction */ - job_ptr->job_state = JOB_FAILED; - job_ptr->end_time = 0; + job_ptr->job_state = JOB_FAILED; + job_ptr->start_time = 0; + job_ptr->end_time = 0; } if (!no_alloc) { @@ -1277,6 +1282,10 @@ job_complete(uint32_t job_id, uid_t uid, bool requeue, if (requeue && job_ptr->details && job_ptr->batch_flag) { job_ptr->job_state = JOB_PENDING | job_comp_flag; info("Requeing job %u", job_ptr->job_id); + } else if (job_ptr->job_state == JOB_PENDING) { + job_ptr->job_state = JOB_COMPLETE; + job_ptr->start_time = 0; + job_ptr->end_time = 0; } else { if (job_return_code) job_ptr->job_state = JOB_FAILED | job_comp_flag; -- GitLab