Changeset 11055 for trunk/Ohana/src/opihi/pantasks/CheckJobs.c
- Timestamp:
- Jan 11, 2007, 4:51:41 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pantasks/CheckJobs.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/CheckJobs.c
r9278 r11055 5 5 FILE *f; 6 6 Job *job; 7 Task *task; 7 8 Macro *macro; 8 9 int i, status; … … 13 14 while ((job = NextJob ()) != NULL) { 14 15 16 task = job[0].task; 17 15 18 /* check poll period (ready to ask for status?) */ 16 if (GetTaskTimer(job[0].last) < job[0].task[0].poll_period) continue;19 if (GetTaskTimer(job[0].last) < task[0].poll_period) continue; 17 20 18 21 /* check current status */ … … 20 23 switch (status) { 21 24 case JOB_PENDING: 22 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */25 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) pending\n", task[0].name, job[0].JobID); */ 23 26 break; 24 27 25 28 case JOB_BUSY: 26 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */29 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) busy\n", task[0].name, job[0].JobID); */ 27 30 break; 28 31 … … 35 38 36 39 /* save the stdout and stderr if desired */ 37 if ( job[0].stdout_dump != NULL) {40 if ((job[0].stdout_dump != NULL) && strcasecmp(job[0].stdout_dump, "NULL")) { 38 41 f = fopen (job[0].stdout_dump, "a"); 39 42 if (f == NULL) { … … 44 47 } 45 48 } 46 if ( job[0].stderr_dump != NULL) {49 if ((job[0].stderr_dump != NULL) && strcasecmp(job[0].stderr_dump, "NULL")) { 47 50 f = fopen (job[0].stderr_dump, "a"); 48 51 if (f == NULL) { … … 68 71 set_int_variable ("options:n", job[0].optc); 69 72 73 set_variable ("JOB_DTIME", job[0].dtime); 74 70 75 if (status == JOB_CRASH) { 71 76 /* XXX add an Ncrash element? */ 72 job[0].task[0].Nfailure ++; 77 task[0].Nfailure ++; 78 UpdateTaskTimerStats (task, TIMER_FAILURE, job[0].dtime); 73 79 74 80 /* run task[0].crash macro, if it exists */ 75 81 /* perhaps define PushNamedQueueBuffer */ 76 82 77 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID); 78 if (job[0].task[0].crash != NULL) { 79 exec_loop (job[0].task[0].crash); 83 set_str_variable ("JOB_STATUS", "CRASH"); 84 85 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", task[0].name, job[0].JobID); 86 if (task[0].crash != NULL) { 87 exec_loop (task[0].crash); 80 88 } 81 89 } … … 83 91 /* update the exit status counters */ 84 92 if (job[0].exit_status) { 85 job[0].task[0].Nfailure ++; 93 task[0].Nfailure ++; 94 UpdateTaskTimerStats (task, TIMER_FAILURE, job[0].dtime); 86 95 } else { 87 job[0].task[0].Nsuccess ++; 88 } 96 task[0].Nsuccess ++; 97 UpdateTaskTimerStats (task, TIMER_SUCCESS, job[0].dtime); 98 } 99 100 set_int_variable ("JOB_STATUS", job[0].exit_status); 89 101 90 102 /* run corresponding task[0].exit macro, if it exists */ 91 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);92 macro = job[0].task[0].defexit;93 for (i = 0; i < job[0].task[0].Nexit; i++) {94 if (job[0].exit_status == atoi( job[0].task[0].exit[i][0].name)) {95 macro = job[0].task[0].exit[i];103 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", task[0].name, job[0].JobID); 104 macro = task[0].defexit; 105 for (i = 0; i < task[0].Nexit; i++) { 106 if (job[0].exit_status == atoi(task[0].exit[i][0].name)) { 107 macro = task[0].exit[i]; 96 108 break; 97 109 } … … 106 118 if (queue) InitQueue (queue); 107 119 120 UpdateTaskTimerStats (task, TIMER_ALLJOBS, job[0].dtime); 121 122 task[0].Npending --; 108 123 DeleteJob (job); 109 124 continue; … … 120 135 */ 121 136 if (job[0].mode == JOB_LOCAL) { 122 if (GetTaskTimer(job[0].start) < job[0].task[0].timeout_period) continue;123 if (VerboseMode()) gprint (GP_LOG, "timeout on %s\n", job[0].task[0].name);137 if (GetTaskTimer(job[0].start) < task[0].timeout_period) continue; 138 if (VerboseMode()) gprint (GP_LOG, "timeout on %s\n", task[0].name); 124 139 125 140 // XXX harvest STDERR and STDOUT from timeout job (should be available...) … … 127 142 128 143 /* update the timeout counter */ 129 job[0].task[0].Ntimeout ++;144 task[0].Ntimeout ++; 130 145 131 146 if (!KillLocalJob (job)) { … … 150 165 151 166 /* run task[0].timeout macro, if it exists */ 152 if ( job[0].task[0].timeout != NULL) {153 exec_loop ( job[0].task[0].timeout);167 if (task[0].timeout != NULL) { 168 exec_loop (task[0].timeout); 154 169 } 155 170 DeleteJob (job);
Note:
See TracChangeset
for help on using the changeset viewer.
