From d973bcac159eec0c1f65fdb94d3e28f76cd1c127 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Oct 2008 22:07:35 +0000 Subject: [PATCH] - scheduler: move core_client_version from WORK_REQ to SCHEDULER_REQUEST; WORK_REQ doesn't get initialized in all cases. svn path=/trunk/boinc/; revision=16107 --- checkin_notes | 10 ++++++++++ sched/handle_request.cpp | 13 ++----------- sched/main.cpp | 2 +- sched/sched_send.cpp | 26 ++++++++------------------ sched/server_types.cpp | 11 ++++++++--- sched/server_types.h | 4 ++-- 6 files changed, 31 insertions(+), 35 deletions(-) diff --git a/checkin_notes b/checkin_notes index 124409d929..032016a196 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7927,3 +7927,13 @@ David 1 Oct 2008 sched/ sched_send.cpp + +David 1 Oct 2008 + - scheduler: move core_client_version from WORK_REQ to SCHEDULER_REQUEST; + WORK_REQ doesn't get initialized in all cases. + + sched/ + handle_request.cpp + main.cpp + sched_send.cpp + server_types.cpp,h diff --git a/sched/handle_request.cpp b/sched/handle_request.cpp index 85b5049788..09b11d74bc 100644 --- a/sched/handle_request.cpp +++ b/sched/handle_request.cpp @@ -955,13 +955,7 @@ bool send_code_sign_key( void warn_user_if_core_client_upgrade_scheduled( SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply ) { - - int core_ver; - - core_ver = sreq.core_client_major_version*100; - core_ver += sreq.core_client_minor_version; - - if (core_ver < config.min_core_client_version_announced) { + if (sreq.core_client_version < config.min_core_client_version_announced) { // time remaining in hours, before upgrade required int remaining = config.min_core_client_upgrade_deadline-time(0); @@ -1351,9 +1345,6 @@ void process_request( goto leave; } - reply.wreq.core_client_version = - sreq.core_client_major_version*100 + sreq.core_client_minor_version; - handle_global_prefs(sreq, reply); handle_results(sreq, reply); @@ -1476,7 +1467,7 @@ void handle_request(FILE* fin, FILE* fout, char* code_sign_key) { log_user_messages(sreply); } - sreply.write(fout); + sreply.write(fout, sreq); if (strlen(config.sched_lockfile_dir)) { unlock_sched(sreply); diff --git a/sched/main.cpp b/sched/main.cpp index b0a18dec59..69ec6053d7 100644 --- a/sched/main.cpp +++ b/sched/main.cpp @@ -122,7 +122,7 @@ void debug_sched( "Found %s, so writing %s\n", trigger, tmpfilename ); - sreply.write(fp); + sreply.write(fp, sreq); fclose(fp); sprintf(tmpfilename, "sched_request_%06d_%06d", sreq.hostid, sreq.rpc_seqno); diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index dc453d9004..172896f8ba 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -178,10 +178,10 @@ BEST_APP_VERSION* get_app_version( APP_VERSION& av = ssp->app_versions[j]; if (av.appid != wu.appid) continue; if (av.platformid != p->id) continue; - if (reply.wreq.core_client_version < av.min_core_version) { + if (sreq.core_client_version < av.min_core_version) { log_messages.printf(MSG_NORMAL, "outdated client version %d < min core version %d\n", - reply.wreq.core_client_version, av.min_core_version + sreq.core_client_version, av.min_core_version ); reply.wreq.outdated_core = true; continue; @@ -719,16 +719,6 @@ int insert_wu_tags(WORKUNIT& wu, APP& app) { return insert_after(wu.xml_doc, "\n", buf); } -// verify that the given APP_VERSION will work with the core client -// -bool app_core_compatible(WORK_REQ& wreq, APP_VERSION& av) { - if (wreq.core_client_version < av.min_core_version) { - wreq.outdated_core = true; - return false; - } - return true; -} - // add the given workunit to a reply. // Add the app and app_version to the reply also. // @@ -1099,7 +1089,7 @@ int add_result_to_reply( // send messages to user about why jobs were or weren't sent // -static void explain_to_user(SCHEDULER_REPLY& reply) { +static void explain_to_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { char helpful[512]; unsigned int i; int j; @@ -1183,7 +1173,7 @@ static void explain_to_user(SCHEDULER_REPLY& reply) { reply.insert_message(um); } if (reply.wreq.speed.insufficient) { - if (reply.wreq.core_client_version>419) { + if (sreq.core_client_version>419) { sprintf(helpful, "(won't finish in time) " "BOINC runs %.1f%% of time, computation enabled %.1f%% of that", @@ -1271,8 +1261,8 @@ static void explain_to_user(SCHEDULER_REPLY& reply) { } } -static void get_running_frac(SCHEDULER_REPLY& reply) { - if (reply.wreq.core_client_version<=419) { +static void get_running_frac(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { + if (sreq.core_client_version<=419) { reply.wreq.running_frac = reply.host.on_frac; } else { reply.wreq.running_frac = reply.host.active_frac * reply.host.on_frac; @@ -1374,7 +1364,7 @@ void send_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { set_trust(reply); - get_running_frac(reply); + get_running_frac(sreq, reply); if (config.debug_send) { log_messages.printf(MSG_DEBUG, @@ -1430,7 +1420,7 @@ void send_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { send_work_old(sreq, reply); } - explain_to_user(reply); + explain_to_user(sreq, reply); } // Matchmaker scheduling code follows diff --git a/sched/server_types.cpp b/sched/server_types.cpp index d4e59ae4e9..8a3e2e9dd5 100644 --- a/sched/server_types.cpp +++ b/sched/server_types.cpp @@ -133,6 +133,8 @@ SCHEDULER_REQUEST::SCHEDULER_REQUEST() { SCHEDULER_REQUEST::~SCHEDULER_REQUEST() { } +// return an error message or NULL +// const char* SCHEDULER_REQUEST::parse(FILE* fin) { char buf[256]; RESULT result; @@ -177,7 +179,10 @@ const char* SCHEDULER_REQUEST::parse(FILE* fin) { continue; } - if (match_tag(buf, "")) return NULL; + if (match_tag(buf, "")) { + core_client_version = 100*core_client_major_version + core_client_minor_version; + return NULL; + } if (parse_str(buf, "", authenticator, sizeof(authenticator))) { remove_quotes(authenticator); continue; @@ -518,7 +523,7 @@ SCHEDULER_REPLY::SCHEDULER_REPLY() { SCHEDULER_REPLY::~SCHEDULER_REPLY() { } -int SCHEDULER_REPLY::write(FILE* fout) { +int SCHEDULER_REPLY::write(FILE* fout, SCHEDULER_REQUEST& sreq) { unsigned int i; char buf[BLOB_SIZE]; @@ -563,7 +568,7 @@ int SCHEDULER_REPLY::write(FILE* fout) { host.id, wreq.nresults, request_delay, elapsed_wallclock_time() ); - if (wreq.core_client_version <= 419) { + if (sreq.core_client_version <= 419) { std::string msg; std::string pri = "low"; for (i=0; i