IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 11, 2007, 10:56:27 AM (19 years ago)
Author:
eugene
Message:

adding intelligent timeouts to task and job threads; removing deprecated files

File:
1 edited

Legend:

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

    r11898 r12404  
    11# include "pantasks.h"
    22
    3 int CheckJobs () {
     3float CheckJobs () {
    44
    55  FILE *f;
     
    1010  char varname[64];
    1111  Queue *queue;
     12  float time_running, next_timeout;
    1213
    1314  // int Ncheck;
    1415  // Ncheck = 0;
     16
     17  // actual maximum delay is controlled in job_threads.c
     18  next_timeout = 1.0;
    1519
    1620  /** test all jobs: ready to test?  finished? **/
     
    2125
    2226    /* check poll period (ready to ask for status?) */
    23     if (GetTaskTimer(job[0].last, FALSE) < task[0].poll_period) continue;
     27    time_running = GetTaskTimer(job[0].last, FALSE);
     28    // fprintf (stderr, "next: %f, poll: %f, run: %f\n", next_timeout, task[0].poll_period, time_running);
     29    if (time_running < task[0].poll_period) {
     30      next_timeout = MIN (next_timeout, task[0].poll_period - time_running);
     31      continue;
     32    }
     33    next_timeout = 0.0;
    2434
    2535    /* check current status */
     
    139149     */
    140150    if (job[0].mode == JOB_LOCAL) {
    141       if (GetTaskTimer(job[0].start, FALSE) < task[0].timeout_period) continue;
     151      if (GetTaskTimer(job[0].start, FALSE) < task[0].timeout_period) {
     152        /* reset polling clock */
     153        SetTaskTimer (&job[0].last);
     154        continue;
     155      }
    142156      if (VerboseMode()) gprint (GP_LOG, "timeout on %s\n", task[0].name);
    143157
     
    180194    /* reset polling clock */
    181195    SetTaskTimer (&job[0].last);
    182     if (TestElapsedCheck()) {
    183       // fprintf (stderr, "check %d jobs\n", Ncheck);
    184       return (TRUE);
    185     }
    186196  }
    187197  // fprintf (stderr, "check %d jobs\n", Ncheck);
    188   return (TRUE);
     198  return (next_timeout);
    189199}
    190200
Note: See TracChangeset for help on using the changeset viewer.