- client: add --start_delay cmdline option and <start_delay> config option.

Specifies an amount of time to delay starting apps
    (e.g. so that BOINC doesn't slow down boot process)

    Note: mechanisms that start BOINC at boot time
    need to figure out how to set this flag.

svn path=/trunk/boinc/; revision=14445
This commit is contained in:
David Anderson 2007-12-27 21:40:20 +00:00
parent 55c0ee22a0
commit 9b2998009f
9 changed files with 39 additions and 7 deletions

View File

@ -12521,7 +12521,7 @@ David 24 Dec 2007
sched/
sched_send.C
David 24 Dec 2007
David 27 Dec 2007
- web: default for user_links() is to not show profile pic.
Show the pic only in the context of friends list.
@ -12532,3 +12532,20 @@ David 24 Dec 2007
user.inc
user/
friend.php
David 27 Dec 2007
- client: add --start_delay cmdline option and <start_delay> config option.
Specifies an amount of time to delay starting apps
(e.g. so that BOINC doesn't slow down boot process)
Note: mechanisms that start BOINC at boot time
need to figure out how to set this flag.
client/
client_state.C,h
cs_cmdline.C
cs_prefs.C
hostinfo_network.C
log_flags.C,h
lib/
common_defs.h

View File

@ -163,6 +163,7 @@ int CLIENT_STATE::init() {
srand((unsigned int)time(0));
now = dtime();
client_start_time = now;
scheduler_op->url_random = drand();
detect_platforms();

View File

@ -156,6 +156,7 @@ public:
// this affects auto-update
bool run_by_updater;
double now;
double client_start_time;
double last_wakeup_time;
bool initialized;
bool cant_write_state_file;

View File

@ -63,6 +63,7 @@ static void print_options(char* prog) {
" --insecure disable app sandboxing (Unix)\n"
" --launched_by_manager core client was launched by Manager\n"
" --run_by_updater set by updater\n"
" --start_delay X delay starting apps for X secs\n"
,
prog, prog, prog
);
@ -86,6 +87,7 @@ void CLIENT_STATE::parse_cmdline(int argc, char** argv) {
for (i=1; i<argc; i++) {
if (ARG(exit_when_idle)) {
exit_when_idle = true;
config.report_results_immediately = true;
} else if (ARG(exit_before_start)) {
exit_before_start = true;
} else if (ARG(exit_after_finish)) {
@ -196,6 +198,9 @@ void CLIENT_STATE::parse_cmdline(int argc, char** argv) {
launched_by_manager = true;
} else if (ARG(run_by_updater)) {
run_by_updater = true;
} else if (ARG(start_delay)) {
if (i == argc-1) show_options = true;
else config.start_delay = atof(argv[++i]);
} else {
printf("Unknown option: %s\n", argv[i]);
show_options = true;

View File

@ -105,17 +105,17 @@ int CLIENT_STATE::allowed_project_disk_usage(double& size) {
}
#endif
// See if (on the basis of user run request and prefs)
// we should suspend processing
// See if we should suspend processing
//
int CLIENT_STATE::check_suspend_processing() {
// Don't work while we're running CPU benchmarks
//
if (are_cpu_benchmarks_running()) {
return SUSPEND_REASON_BENCHMARKS;
}
if (config.start_delay && now < client_start_time + config.start_delay) {
return SUSPEND_REASON_INITIAL_DELAY;
}
switch(run_mode.get_current()) {
case RUN_MODE_ALWAYS: break;
case RUN_MODE_NEVER:

View File

@ -63,6 +63,10 @@ int HOST_INFO::get_local_network_info() {
strcpy(domain_name, "");
strcpy(ip_addr, "");
// it seems like we should use getdomainname() instead of gethostname(),
// but on FC6 it returns "(none)".
//
if (gethostname(domain_name, 256)) return ERR_GETHOSTBYNAME;
he = gethostbyname(domain_name);
if (!he || !he->h_addr_list[0]) {

View File

@ -204,6 +204,7 @@ void CONFIG::defaults() {
max_stderr_file_size = 0;
alt_platforms.clear();
report_results_immediately = false;
start_delay = 0;
}
int CONFIG::parse_options(XML_PARSER& xp) {
@ -247,6 +248,7 @@ int CONFIG::parse_options(XML_PARSER& xp) {
if (xp.parse_int(tag, "max_stdout_file_size", max_stdout_file_size)) continue;
if (xp.parse_int(tag, "max_stderr_file_size", max_stderr_file_size)) continue;
if (xp.parse_bool(tag, "report_results_immediately", report_results_immediately)) continue;
if (xp.parse_double(tag, "start_delay", start_delay)) continue;
msg_printf(NULL, MSG_USER_ERROR, "Unparsed tag in %s: <%s>\n",
CONFIG_FILE, tag
);

View File

@ -101,6 +101,7 @@ struct CONFIG {
int max_stdout_file_size;
int max_stderr_file_size;
bool report_results_immediately;
double start_delay;
CONFIG();
void defaults();

View File

@ -110,7 +110,8 @@ enum SUSPEND_REASON {
SUSPEND_REASON_BENCHMARKS = 16,
SUSPEND_REASON_DISK_SIZE = 32,
SUSPEND_REASON_CPU_USAGE_LIMIT = 64,
SUSPEND_REASON_NO_RECENT_INPUT = 128
SUSPEND_REASON_NO_RECENT_INPUT = 128,
SUSPEND_REASON_INITIAL_DELAY = 256,
};
// States of a result on a client.