resend lost results

svn path=/trunk/boinc/; revision=6866
This commit is contained in:
David Anderson 2005-07-28 10:13:30 +00:00
parent 2e4989c238
commit 3f785e8bdd
7 changed files with 99 additions and 38 deletions

View File

@ -9644,3 +9644,15 @@ Rom 28 July 2005
BOINCGUI.pjd
WizAttachProject.cpp
WizAttachProject.h
David 28 July 2005
- scheduler: if the <other_results> list is present in request,
resend any in-progress results not on the list.
Enabled by <send_lost_results>1</send_lost_results> in config.xml
(with Bruce Allen)
sched/
handle_request.C
sched_locality.C
sched_send.C,h
server_types.C,h

View File

@ -1108,8 +1108,8 @@ void process_request(
handle_results(sreq, reply);
if (config.resend_lost_results) {
if (resend_lost_work(sreq, reply)) {
if (config.resend_lost_results && sreq.have_other_results_list) {
if (resend_lost_work(sreq, reply, *platform, ss)) {
ok_to_send_work = false;
}
}

View File

@ -241,36 +241,6 @@ int decrement_disk_space_locality(
return -1;
}
// Find the app and app_version for the client's platform.
//
static int get_app_version(
WORKUNIT& wu, APP* &app, APP_VERSION* &avp,
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
SCHED_SHMEM& ss
) {
bool found;
if (anonymous(platform)) {
app = ss.lookup_app(wu.appid);
found = sreq.has_version(*app);
if (!found) {
return ERR_NO_APP_VERSION;
}
avp = NULL;
} else {
found = find_app_version(reply.wreq, wu, platform, ss, app, avp);
if (!found) {
return ERR_NO_APP_VERSION;
}
// see if the core client is too old.
//
if (!app_core_compatible(reply.wreq, *avp)) {
return ERR_NO_APP_VERSION;
}
}
return 0;
}
// Try to send the client this result
// This can fail because:
// - result needs more disk/mem/speed than host has

View File

@ -71,6 +71,36 @@ bool SCHEDULER_REQUEST::has_version(APP& app) {
return false;
}
// Find the app and app_version for the client's platform.
//
int get_app_version(
WORKUNIT& wu, APP* &app, APP_VERSION* &avp,
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
SCHED_SHMEM& ss
) {
bool found;
if (anonymous(platform)) {
app = ss.lookup_app(wu.appid);
found = sreq.has_version(*app);
if (!found) {
return ERR_NO_APP_VERSION;
}
avp = NULL;
} else {
found = find_app_version(reply.wreq, wu, platform, ss, app, avp);
if (!found) {
return ERR_NO_APP_VERSION;
}
// see if the core client is too old.
//
if (!app_core_compatible(reply.wreq, *avp)) {
return ERR_NO_APP_VERSION;
}
}
return 0;
}
// compute the max additional disk usage we can impose on the host
//
double max_allowable_disk(SCHEDULER_REQUEST& req, SCHEDULER_REPLY& reply) {
@ -1012,20 +1042,26 @@ int send_work(
return 0;
}
bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
bool resend_lost_work(
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
SCHED_SHMEM& ss
) {
DB_RESULT result;
std::vector<DB_RESULT>results;
unsigned int i;
char buf[256];
bool did_any = false;
int num_to_resend=0;
APP* app;
APP_VERSION* avp;
int retval;
// look at other results. for now just print
// print list of results on host
//
for (i=0; i<sreq.other_results.size(); i++) {
OTHER_RESULT& orp=sreq.other_results[i];
log_messages.printf(SCHED_MSG_LOG::DEBUG,
"Result already on [HOST#%d]: %s\n",
"Result is on [HOST#%d]: %s\n",
reply.host.id, orp.name.c_str()
);
}
@ -1048,6 +1084,36 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
"[HOST#%d] Would resend lost [RESULT#%d]: %s\n",
reply.host.id, result.id, result.name
);
DB_WORKUNIT wu;
retval = wu.lookup_id(result.workunitid);
if (retval) {
log_messages.printf( SCHED_MSG_LOG::CRITICAL,
"[HOST#%d] WU not found for [RESULT#%d]\n",
reply.host.id, result.id
);
continue;
}
retval = get_app_version(
wu, app, avp, sreq, reply, platform, ss
);
if (retval) {
log_messages.printf( SCHED_MSG_LOG::CRITICAL,
"[HOST#%d] no app version [RESULT#%d]\n",
reply.host.id, result.id
);
continue;
}
retval = add_result_to_reply(
result, wu, sreq, reply, platform, app, avp
);
if (retval) {
log_messages.printf( SCHED_MSG_LOG::CRITICAL,
"[HOST#%d] failed to send [RESULT#%d]\n",
reply.host.id, result.id
);
continue;
}
did_any = true;
}
}
@ -1057,8 +1123,7 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
);
}
return false;
//return did_any;
return did_any;
}
const char *BOINC_RCSID_32dcd335e7 = "$Id$";

View File

@ -17,6 +17,12 @@
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
extern int get_app_version(
WORKUNIT& wu, APP* &app, APP_VERSION* &avp,
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
SCHED_SHMEM& ss
);
extern int send_work(
SCHEDULER_REQUEST&, SCHEDULER_REPLY&, PLATFORM&, SCHED_SHMEM&
);
@ -45,4 +51,6 @@ extern bool app_core_compatible(WORK_REQ& wreq, APP_VERSION& av);
extern int wu_is_infeasible(WORKUNIT&, SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
extern double max_allowable_disk(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
extern bool resend_lost_work(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
extern bool resend_lost_work(
SCHEDULER_REQUEST&, SCHEDULER_REPLY&, PLATFORM&, SCHED_SHMEM&
);

View File

@ -114,6 +114,8 @@ int SCHEDULER_REQUEST::parse(FILE* fin) {
anonymous_platform = false;
memset(&global_prefs, 0, sizeof(global_prefs));
memset(&host, 0, sizeof(host));
have_other_results_list = false;
have_ip_results_list = false;
fgets(buf, 256, fin);
if (!match_tag(buf, "<scheduler_request>")) return ERR_XML_PARSE;
@ -199,6 +201,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) {
} else if (match_tag(buf, "<host_venue>")) {
continue;
} else if (match_tag(buf, "<other_results>")) {
have_other_results_list = true;
while (fgets(buf, 256, fin)) {
if (match_tag(buf, "</other_results>")) break;
if (match_tag(buf, "<other_result>")) {
@ -211,6 +214,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) {
}
continue;
} else if (match_tag(buf, "<in_progress_results>")) {
have_ip_results_list = true;
while (fgets(buf, 256, fin)) {
if (match_tag(buf, "</in_progress_results>")) break;
if (match_tag(buf, "<ip_result>")) {

View File

@ -147,6 +147,8 @@ struct SCHEDULER_REQUEST {
std::vector<FILE_INFO> file_infos; // sticky files reported by host
std::vector<OTHER_RESULT> other_results;
std::vector<IP_RESULT> ip_results;
bool have_other_results_list;
bool have_ip_results_list;
SCHEDULER_REQUEST();
~SCHEDULER_REQUEST();