IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 4, 2006, 2:19:21 AM (20 years ago)
Author:
eugene
Message:

adding task options

File:
1 edited

Legend:

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

    r7917 r8129  
    2626
    2727      case JOB_CRASH:
    28         /* run task[0].crash macro, if it exists */
     28      case JOB_EXIT:
    2929        /* push output buffer data to the stdout and stderr queues */
    30         if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);
     30        /* XXX this will break on 0 values in output streams */
    3131        PushNamedQueue ("stdout", job[0].stdout.buffer);
    3232        PushNamedQueue ("stderr", job[0].stderr.buffer);
     33
    3334        /* set taskarg variables */
    3435        for (i = 0; i < job[0].argc; i++) {
     
    3839        set_int_variable ("taskarg:n", job[0].argc);
    3940
    40         /* XXX this will break on 0 values in output streams */
    41         /* perhaps define PushNamedQueueBuffer */
    42         if (job[0].task[0].crash != NULL) {
    43           exec_loop (job[0].task[0].crash);
     41        /* set options variables */
     42        for (i = 0; i < job[0].optc; i++) {
     43            sprintf (varname, "options:%d", i);
     44            set_str_variable (varname, job[0].optv[i]);
    4445        }
    45         DeleteJob (job);
    46         continue;
    47         break;
     46        set_int_variable ("options:n", job[0].optc);
    4847
    49       case JOB_EXIT:
    50         if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);
    51         PushNamedQueue ("stdout", job[0].stdout.buffer);
    52         PushNamedQueue ("stderr", job[0].stderr.buffer);
    53         /* set taskarg variables */
    54         for (i = 0; i < job[0].argc; i++) {
    55             sprintf (varname, "taskarg:%d", i);
    56             set_str_variable (varname, job[0].argv[i]);
     48        if (status == JOB_CRASH) {
     49          /* XXX add an Ncrash element? */
     50          job[0].task[0].Nfailure ++;
     51
     52          /* run task[0].crash macro, if it exists */
     53          /* perhaps define PushNamedQueueBuffer */
     54
     55          if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);
     56          if (job[0].task[0].crash != NULL) {
     57            exec_loop (job[0].task[0].crash);
     58          }
    5759        }
    58         set_int_variable ("taskarg:n", job[0].argc);
     60        if (status == JOB_EXIT) {
     61          /* update the exit status counters */
     62          if (job[0].exit_status) {
     63            job[0].task[0].Nfailure ++;
     64          } else {
     65            job[0].task[0].Nsuccess ++;
     66          }
    5967
    60         /* update the exit status counters */
    61         if (job[0].exit_status) {
    62             job[0].task[0].Nfailure ++;
    63         } else {
    64             job[0].task[0].Nsuccess ++;
     68          /* run corresponding task[0].exit macro, if it exists */
     69          if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);
     70          macro = job[0].task[0].defexit;
     71          for (i = 0; i < job[0].task[0].Nexit; i++) {
     72            if (job[0].exit_status == atoi(job[0].task[0].exit[i][0].name)) {
     73              macro = job[0].task[0].exit[i];
     74              break;
     75            }
     76          }
     77          if (macro != NULL) exec_loop (macro);
    6578        }
    6679
    67         /* run corresponding task[0].exit macro, if it exists */
    68         macro = job[0].task[0].defexit;
    69         for (i = 0; i < job[0].task[0].Nexit; i++) {
    70           if (job[0].exit_status == atoi(job[0].task[0].exit[i][0].name)) {
    71             macro = job[0].task[0].exit[i];
    72             break;
    73           }
    74         }
    75         if (macro != NULL) exec_loop (macro);
    7680        DeleteJob (job);
    7781        continue;
     
    107111      set_int_variable ("taskarg:n", job[0].argc);
    108112
     113      /* set options variables */
     114      for (i = 0; i < job[0].optc; i++) {
     115        sprintf (varname, "options:%d", i);
     116        set_str_variable (varname, job[0].optv[i]);
     117      }
     118      set_int_variable ("options:n", job[0].optc);
    109119
    110120      /* run task[0].timeout macro, if it exists */
Note: See TracChangeset for help on using the changeset viewer.