Skip to content
Snippets Groups Projects
Commit b22ebc4a authored by Moe Jette's avatar Moe Jette
Browse files

Don't consider job done until COMPLETED (not COMPLETING).

parent 751e747a
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,11 @@ ...@@ -64,6 +64,11 @@
/* Change TRIGGER_STATE_VERSION value when changing the state save format */ /* Change TRIGGER_STATE_VERSION value when changing the state save format */
#define TRIGGER_STATE_VERSION "VER001" #define TRIGGER_STATE_VERSION "VER001"
/* TRIG_IS_JOB_FINI differs from IS_JOB_FINISHED by considering
* completing jobs as not really finished */
#define TRIG_IS_JOB_FINI(_X) \
(IS_JOB_FINISHED(_X) && ((_X->job_state & JOB_COMPLETING) == 0))
List trigger_list; List trigger_list;
uint32_t next_trigger_id = 1; uint32_t next_trigger_id = 1;
static pthread_mutex_t trigger_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t trigger_mutex = PTHREAD_MUTEX_INITIALIZER;
...@@ -408,7 +413,7 @@ static int _load_trigger_state(Buf buffer) ...@@ -408,7 +413,7 @@ static int _load_trigger_state(Buf buffer)
trig_ptr->job_ptr = find_job_record(trig_ptr->job_id); trig_ptr->job_ptr = find_job_record(trig_ptr->job_id);
if ((trig_ptr->job_id == 0) if ((trig_ptr->job_id == 0)
|| (trig_ptr->job_ptr == NULL) || (trig_ptr->job_ptr == NULL)
|| (IS_JOB_FINISHED(trig_ptr->job_ptr))) || (TRIG_IS_JOB_FINI(trig_ptr->job_ptr)))
goto unpack_error; goto unpack_error;
} else { } else {
trig_ptr->job_id = 0; trig_ptr->job_id = 0;
...@@ -599,12 +604,12 @@ fini: verbose("State of %d triggers recovered", trigger_cnt); ...@@ -599,12 +604,12 @@ fini: verbose("State of %d triggers recovered", trigger_cnt);
static void _trigger_job_event(trig_mgr_info_t *trig_in, time_t now) static void _trigger_job_event(trig_mgr_info_t *trig_in, time_t now)
{ {
if ((trig_in->job_ptr == NULL) if ((trig_in->job_ptr == NULL)
|| (trig_in->job_ptr->job_id == trig_in->job_id)) || (trig_in->job_ptr->job_id != trig_in->job_id))
trig_in->job_ptr = find_job_record(trig_in->job_ptr->job_id); trig_in->job_ptr = find_job_record(trig_in->job_ptr->job_id);
if ((trig_in->trig_type & TRIGGER_TYPE_FINI) if ((trig_in->trig_type & TRIGGER_TYPE_FINI)
&& ((trig_in->job_ptr == NULL) || && ((trig_in->job_ptr == NULL) ||
(IS_JOB_FINISHED(trig_in->job_ptr)))) { (TRIG_IS_JOB_FINI(trig_in->job_ptr)))) {
trig_in->state = 1; trig_in->state = 1;
trig_in->trig_time = now + (trig_in->trig_time - 0x8000); trig_in->trig_time = now + (trig_in->trig_time - 0x8000);
#if _DEBUG #if _DEBUG
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment