Changeset 10693 for trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
- Timestamp:
- Dec 13, 2006, 8:55:12 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/CheckSystem.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
r10668 r10693 3 3 4 4 static 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; 5 static RunLevels RunLevel = PCONTROL_RUN_NONE; 6 7 RunLevels SetRunLevel (RunLevels level) { 8 RunLevels oldlevel; 9 oldlevel = RunLevel; 10 RunLevel = level; 11 return oldlevel; 12 } 13 14 RunLevels GetRunLevel () { 15 return RunLevel; 12 16 } 13 17 … … 65 69 TestCheckPoint (); 66 70 67 // don't run the system checks if Run Systemis FALSE71 // don't run the system checks if RunLevel is FALSE 68 72 // XXX stop should not suspend all checks: we should continue 69 73 // to harvest completed jobs and migrate idle machines to down 70 if ( !RunSystem) {71 usleep ( 50000); // idle if RunSystem is FALSE74 if (RunLevel == PCONTROL_RUN_NONE) { 75 usleep (100000); // idle if we are running nothing 72 76 continue; 73 77 } 74 75 Njobchecks = 0;76 Nhostchecks = 0;77 78 // we want to give each block a maximum allowed time79 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 ();90 78 91 79 /* always allow at least one test */ 92 80 /* most tests require about 2ms per host. 93 81 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 } 94 107 95 108 // 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)) { 97 110 CheckLiveHosts(0.040); 98 111 usleep (100000); // idle if no jobs are waiting 99 112 } 100 113 101 114 if (DEBUG) { 102 115 Stack *stack;
Note:
See TracChangeset
for help on using the changeset viewer.
