IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 13, 2006, 8:55:12 AM (19 years ago)
Author:
eugene
Message:

added run level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/CheckSystem.c

    r10668 r10693  
    33
    44static struct timeval lastlive = {0, 0};
    5 static int RunSystem = FALSE;
    6 
    7 int SetRunSystem (int state) {
    8   int oldstate;
    9   oldstate = RunSystem;
    10   RunSystem = state;
    11   return oldstate;
     5static RunLevels RunLevel = PCONTROL_RUN_NONE;
     6
     7RunLevels SetRunLevel (RunLevels level) {
     8  RunLevels oldlevel;
     9  oldlevel = RunLevel;
     10  RunLevel = level;
     11  return oldlevel;
     12}
     13
     14RunLevels GetRunLevel () {
     15  return RunLevel;
    1216}
    1317
     
    6569    TestCheckPoint ();
    6670
    67     // don't run the system checks if RunSystem is FALSE
     71    // don't run the system checks if RunLevel is FALSE
    6872    // XXX stop should not suspend all checks: we should continue
    6973    // to harvest completed jobs and migrate idle machines to down
    70     if (!RunSystem) {
    71       usleep (50000); // idle if RunSystem is FALSE
     74    if (RunLevel == PCONTROL_RUN_NONE) {
     75      usleep (100000); // idle if we are running nothing
    7276      continue;
    7377    }
    74 
    75     Njobchecks = 0;
    76     Nhostchecks = 0;
    77 
    78     // we want to give each block a maximum allowed time
    79     Nhostchecks += CheckIdleHosts(0.020); /* submit a new job */
    80     TestCheckPoint ();
    81 
    82     Njobchecks  += CheckBusyJobs(0.020);  /* get job status */
    83     Njobchecks  += CheckDoneJobs(0.020);  /* harvest job stdout/stderr */
    84     Njobchecks  += CheckKillJobs(0.020);  /* harvest job stdout/stderr */
    85     TestCheckPoint ();
    86 
    87     Nhostchecks += CheckDoneHosts(0.020); /* reset the host */
    88     Nhostchecks += CheckDownHosts(0.100); /* launch the host */
    89     TestCheckPoint ();
    9078
    9179    /* always allow at least one test */
    9280    /* most tests require about 2ms per host. 
    9381       CheckDoneJobs must depend on the size of the output buffer */
     82    /* the max delay times are fairly arbitrary and do not impact
     83       the user interface.
     84     */
     85
     86    Njobchecks = 0;
     87    Nhostchecks = 0;
     88
     89    if ((RunLevel == PCONTROL_RUN_ALL) || (RunLevel == PCONTROL_RUN_REAP)) {
     90      Njobchecks  += CheckBusyJobs(0.020);  /* get job status */
     91      Njobchecks  += CheckDoneJobs(0.020);  /* harvest job stdout/stderr */
     92      Njobchecks  += CheckKillJobs(0.020);  /* harvest job stdout/stderr */
     93      TestCheckPoint ();
     94    }
     95
     96    if (RunLevel != PCONTROL_RUN_NONE) {
     97      Nhostchecks += CheckDoneHosts(0.020); /* reset the host */
     98      Nhostchecks += CheckDownHosts(0.100); /* launch the host */
     99      TestCheckPoint ();
     100    }
     101
     102    if (RunLevel == PCONTROL_RUN_ALL) {
     103      // we want to give each block a maximum allowed time
     104      Nhostchecks += CheckIdleHosts(0.020); /* submit a new job */
     105      TestCheckPoint ();
     106    }
    94107
    95108    // there is nothing on the stacks.  test the hosts and wait a bit
    96     if (!Njobchecks && !Nhostchecks) {
     109    if (!Njobchecks && !Nhostchecks && (RunLevel != PCONTROL_RUN_NONE)) {
    97110      CheckLiveHosts(0.040);
    98111      usleep (100000); // idle if no jobs are waiting
    99112    }
    100 
     113   
    101114    if (DEBUG) {
    102115      Stack *stack;
Note: See TracChangeset for help on using the changeset viewer.