mirror of https://github.com/BOINC/boinc.git
exit_when_idle logic
svn path=/trunk/boinc/; revision=896
This commit is contained in:
parent
b070baec50
commit
9e11a1e95c
|
@ -3179,3 +3179,18 @@ David Feb 12 2003
|
|||
test.inc
|
||||
tools/
|
||||
add.C
|
||||
|
||||
David Feb 12 2003
|
||||
- changed "exit_after" to "exit_after_app_started_secs"
|
||||
and changed its null value from -1 to 0.
|
||||
- don't ask a scheduler for work if in exit_when_idle mode
|
||||
and we've already contacted scheduler
|
||||
- remove exit_when_idle clause from backoff after no work available
|
||||
|
||||
client/
|
||||
client_state.C,h
|
||||
cs_apps.C
|
||||
cs_scheduler.C
|
||||
scheduler_op.C
|
||||
test/
|
||||
test_time.php
|
||||
|
|
|
@ -72,7 +72,7 @@ CLIENT_STATE::CLIENT_STATE() {
|
|||
core_client_major_version = MAJOR_VERSION;
|
||||
core_client_minor_version = MINOR_VERSION;
|
||||
platform_name = HOST;
|
||||
exit_after = -1;
|
||||
exit_after_app_start_secs = 0;
|
||||
app_started = 0;
|
||||
max_transfer_rate = 9999;
|
||||
max_bytes = 0;
|
||||
|
@ -1104,8 +1104,8 @@ void CLIENT_STATE::parse_cmdline(int argc, char** argv) {
|
|||
run_time_test = false;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(argv[i], "-exit_after")) {
|
||||
exit_after = atoi(argv[++i]);
|
||||
if (!strcmp(argv[i], "-exit_after_app_start")) {
|
||||
exit_after_app_start_secs = atoi(argv[++i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1172,13 +1172,16 @@ void CLIENT_STATE::parse_env_vars() {
|
|||
}
|
||||
}
|
||||
|
||||
// Returns true if the core client should exit
|
||||
// Returns true if client should exit because of debugging criteria
|
||||
// (timeout or idle)
|
||||
//
|
||||
bool CLIENT_STATE::time_to_exit() {
|
||||
if (!exit_when_idle && (exit_after == -1)) return false;
|
||||
if ((exit_after != -1) && app_started &&
|
||||
(difftime(time(0), app_started) >= exit_after)) {
|
||||
printf("exiting because time is up: %d\n", exit_after);
|
||||
if (!exit_when_idle && !exit_after_app_start_secs) return false;
|
||||
if (exit_after_app_start_secs
|
||||
&& app_started
|
||||
&& (difftime(time(0), app_started) >= exit_after_app_start_secs)
|
||||
) {
|
||||
printf("exiting because time is up: %d\n", exit_after_app_start_secs);
|
||||
return true;
|
||||
}
|
||||
if (exit_when_idle && (results.size() == 0) && contacted_sched_server) {
|
||||
|
|
|
@ -102,8 +102,10 @@ private:
|
|||
unsigned int nslots;
|
||||
bool run_time_test;
|
||||
bool activities_suspended;
|
||||
int exit_after;
|
||||
int exit_after_app_start_secs;
|
||||
// if nonzero, exit this many seconds after starting an app
|
||||
time_t app_started;
|
||||
// when the most recent app was started
|
||||
int max_transfer_rate, max_bytes;
|
||||
|
||||
int parse_account_files();
|
||||
|
|
|
@ -192,8 +192,9 @@ bool CLIENT_STATE::start_apps() {
|
|||
atp->state = PROCESS_COULDNT_START;
|
||||
atp->result->active_task_state = PROCESS_COULDNT_START;
|
||||
report_project_error(
|
||||
*(atp->result),retval,
|
||||
"Couldn't start the app for this result.\n" );
|
||||
*(atp->result), retval,
|
||||
"Couldn't start the app for this result.\n"
|
||||
);
|
||||
}
|
||||
action = true;
|
||||
set_client_state_dirty("start_apps");
|
||||
|
|
|
@ -250,12 +250,17 @@ bool CLIENT_STATE::some_project_rpc_ok() {
|
|||
bool CLIENT_STATE::scheduler_rpc_poll() {
|
||||
double work_secs;
|
||||
PROJECT* p;
|
||||
bool action=false, below_low_water;
|
||||
bool action=false, below_low_water, should_get_work;
|
||||
|
||||
switch(scheduler_op->state) {
|
||||
case SCHEDULER_OP_STATE_IDLE:
|
||||
below_low_water = (current_water_days() <= global_prefs.low_water_days);
|
||||
if (below_low_water && some_project_rpc_ok()) {
|
||||
if (exit_when_idle && contacted_sched_server) {
|
||||
should_get_work = false;
|
||||
} else {
|
||||
below_low_water = (current_water_days() <= global_prefs.low_water_days);
|
||||
should_get_work = below_low_water && some_project_rpc_ok();
|
||||
}
|
||||
if (should_get_work) {
|
||||
compute_resource_debts();
|
||||
scheduler_op->init_get_work();
|
||||
action = true;
|
||||
|
|
|
@ -419,7 +419,7 @@ bool SCHEDULER_OP::poll() {
|
|||
// if we asked for work and didn't get any,
|
||||
// back off this project
|
||||
//
|
||||
if (must_get_work && nresults==0 &&!gstate.exit_when_idle) {
|
||||
if (must_get_work && nresults==0) {
|
||||
backoff(project, "No work from project\n");
|
||||
} else {
|
||||
project->nrpc_failures = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
$project->start_feeder();
|
||||
$app_time = 0;
|
||||
$host->run("-exit_after 400");
|
||||
$host->run("-exit_after_app_start 400");
|
||||
$app_time += $host->read_cpu_time_file("app.time");
|
||||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
|
Loading…
Reference in New Issue