- 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
This commit is contained in:
David Anderson 2008-10-01 22:07:35 +00:00
parent 632587c3b4
commit d973bcac15
6 changed files with 31 additions and 35 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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, "<workunit>\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

View File

@ -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, "</scheduler_request>")) return NULL;
if (match_tag(buf, "</scheduler_request>")) {
core_client_version = 100*core_client_major_version + core_client_minor_version;
return NULL;
}
if (parse_str(buf, "<authenticator>", 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<messages.size(); i++) {

View File

@ -118,7 +118,6 @@ struct WORK_REQ {
// http://boinc.berkeley.edu/trac/wiki/ClientSched#NormalizedCPUTime
double disk_available;
int nresults;
int core_client_version;
double running_frac;
bool trust; // allow unreplicated jobs to be sent
@ -264,6 +263,7 @@ struct SCHEDULER_REQUEST {
int core_client_major_version;
int core_client_minor_version;
int core_client_release;
int core_client_version; // 100*major + minor
int rpc_seqno;
double work_req_seconds;
// in "normalized CPU seconds" (see work_req.php)
@ -357,7 +357,7 @@ struct SCHEDULER_REPLY {
SCHEDULER_REPLY();
~SCHEDULER_REPLY();
int write(FILE*);
int write(FILE*, SCHEDULER_REQUEST&);
void insert_app_unique(APP&);
void insert_app_version_unique(APP_VERSION&);
void insert_workunit_unique(WORKUNIT&);