IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 31, 2005, 8:04:11 AM (21 years ago)
Author:
eugene
Message:

task/job list cleanup, fixing kill/delete

File:
1 edited

Legend:

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

    r4602 r4684  
    1212  while ((job = NextJob ()) != NULL) {
    1313
    14     /* check for timeout - only local jobs timeout here */
    15     if ((job[0].mode == JOB_LOCAL) && (GetTaskTimer(job[0].start) >= job[0].task[0].timeout_period)) {
    16       if (VerboseMode()) fprintf (stderr, "timeout on %s\n", job[0].task[0].name);
    17       /* run task[0].timeout macro, if it exists */
    18       if (job[0].task[0].timeout != NULL) {
    19         exec_loop (job[0].task[0].timeout);
    20       }
    21       DeleteJob (job);
    22       continue;
    23     }
    24 
    25     /* check poll period (ready to run again?) */
     14    /* check poll period (ready to ask for status?) */
    2615    if (GetTaskTimer(job[0].last) < job[0].task[0].poll_period) continue;
    2716
     
    7463    }
    7564
     65    /* check for timeout - (local jobs only)
     66       we only check timeout after a poll (forces at least one poll)
     67     */
     68    if (job[0].mode == JOB_LOCAL) {
     69      if (GetTaskTimer(job[0].start) < job[0].task[0].timeout_period) continue;
     70      if (VerboseMode()) fprintf (stderr, "timeout on %s\n", job[0].task[0].name);
     71      if (!KillLocalJob (job)) {
     72        job[0].state = JOB_HUNG;
     73        if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);
     74        continue;
     75      }
     76      /* run task[0].timeout macro, if it exists */
     77      if (job[0].task[0].timeout != NULL) {
     78        exec_loop (job[0].task[0].timeout);
     79      }
     80      DeleteJob (job);
     81      continue;
     82    }
     83
    7684    /* reset polling clock */
    7785    SetTaskTimer (&job[0].last);
     
    7987  return (TRUE);
    8088}
     89
     90/*
     91
     92  job / task timeline:
     93
     94  task:
     95  0           exec     
     96  start       create
     97  task clock  new job
     98
     99  job:
     100  0           1xpoll     2xpoll     3xpoll
     101  start       check      check      check
     102  job clock   status     status     status
     103
     104  .           .          .          timeout
     105                                    run
     106                                    timeout
     107
     108  must be at least one poll before timeout
     109  (timeout >= poll)
     110*/
Note: See TracChangeset for help on using the changeset viewer.