IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 11, 2007, 4:51:41 PM (20 years ago)
Author:
eugene
Message:

added timing stats, npending limit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/CheckJobs.c

    r9278 r11055  
    55  FILE *f;
    66  Job *job;
     7  Task *task;
    78  Macro *macro;
    89  int i, status;
     
    1314  while ((job = NextJob ()) != NULL) {
    1415
     16    task = job[0].task;
     17
    1518    /* 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;
    1720
    1821    /* check current status */
     
    2023    switch (status) {
    2124      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); */
    2326        break;
    2427
    2528      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); */
    2730        break;
    2831
     
    3538
    3639        /* 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")) {
    3841          f = fopen (job[0].stdout_dump, "a");
    3942          if (f == NULL) {
     
    4447          }
    4548        }
    46         if (job[0].stderr_dump != NULL) {
     49        if ((job[0].stderr_dump != NULL) && strcasecmp(job[0].stderr_dump, "NULL")) {
    4750          f = fopen (job[0].stderr_dump, "a");
    4851          if (f == NULL) {
     
    6871        set_int_variable ("options:n", job[0].optc);
    6972
     73        set_variable ("JOB_DTIME", job[0].dtime);
     74
    7075        if (status == JOB_CRASH) {
    7176          /* XXX add an Ncrash element? */
    72           job[0].task[0].Nfailure ++;
     77          task[0].Nfailure ++;
     78          UpdateTaskTimerStats (task, TIMER_FAILURE, job[0].dtime);
    7379
    7480          /* run task[0].crash macro, if it exists */
    7581          /* perhaps define PushNamedQueueBuffer */
    7682
    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);
    8088          }
    8189        }
     
    8391          /* update the exit status counters */
    8492          if (job[0].exit_status) {
    85             job[0].task[0].Nfailure ++;
     93            task[0].Nfailure ++;
     94            UpdateTaskTimerStats (task, TIMER_FAILURE, job[0].dtime);
    8695          } 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);
    89101
    90102          /* 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];
    96108              break;
    97109            }
     
    106118        if (queue) InitQueue (queue);
    107119
     120        UpdateTaskTimerStats (task, TIMER_ALLJOBS, job[0].dtime);
     121
     122        task[0].Npending --;
    108123        DeleteJob (job);
    109124        continue;
     
    120135     */
    121136    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);
    124139
    125140      // XXX harvest STDERR and STDOUT from timeout job (should be available...)
     
    127142
    128143      /* update the timeout counter */
    129       job[0].task[0].Ntimeout ++;
     144      task[0].Ntimeout ++;
    130145
    131146      if (!KillLocalJob (job)) {
     
    150165
    151166      /* 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);
    154169      }
    155170      DeleteJob (job);
Note: See TracChangeset for help on using the changeset viewer.