2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-09-13 18:05:54 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2004-09-13 18:05:54 +00:00
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
// Locality scheduling: see doc/sched_locality.php
|
2004-09-10 23:03:13 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2005-01-09 06:38:42 +00:00
|
|
|
#include <unistd.h>
|
2005-01-20 19:07:18 +00:00
|
|
|
#include <strings.h>
|
2005-01-12 00:50:32 +00:00
|
|
|
#include <glob.h>
|
2004-09-10 23:03:13 +00:00
|
|
|
|
|
|
|
#include "boinc_db.h"
|
2005-01-12 00:50:32 +00:00
|
|
|
#include "error_numbers.h"
|
2005-01-12 10:46:44 +00:00
|
|
|
#include "filesys.h"
|
2004-09-10 23:03:13 +00:00
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
#include "server_types.h"
|
|
|
|
#include "sched_shmem.h"
|
|
|
|
#include "sched_send.h"
|
|
|
|
#include "sched_msgs.h"
|
|
|
|
#include "sched_locality.h"
|
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
#define VERBOSE_DEBUG
|
|
|
|
|
2005-01-07 19:45:46 +00:00
|
|
|
// get filename from result name
|
|
|
|
//
|
2004-09-10 23:03:13 +00:00
|
|
|
static int extract_filename(char* in, char* out) {
|
|
|
|
strcpy(out, in);
|
|
|
|
char* p = strstr(out, "__");
|
|
|
|
if (!p) return -1;
|
|
|
|
*p = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss
|
2004-09-10 23:03:13 +00:00
|
|
|
) {
|
|
|
|
bool found;
|
|
|
|
if (anonymous(platform)) {
|
|
|
|
app = ss.lookup_app(wu.appid);
|
|
|
|
found = sreq.has_version(*app);
|
|
|
|
if (!found) {
|
2005-01-12 00:50:32 +00:00
|
|
|
return ERR_NO_APP_VERSION;
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
|
|
|
avp = NULL;
|
|
|
|
} else {
|
2005-01-31 23:20:49 +00:00
|
|
|
found = find_app_version(reply.wreq, wu, platform, ss, app, avp);
|
2004-09-10 23:03:13 +00:00
|
|
|
if (!found) {
|
2005-01-12 00:50:32 +00:00
|
|
|
return ERR_NO_APP_VERSION;
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// see if the core client is too old.
|
|
|
|
//
|
2005-01-31 23:20:49 +00:00
|
|
|
if (!app_core_compatible(reply.wreq, *avp)) {
|
2005-01-12 00:50:32 +00:00
|
|
|
return ERR_NO_APP_VERSION;
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
// Try to send the client this result
|
|
|
|
// This can fail because:
|
2005-02-02 22:58:46 +00:00
|
|
|
// - result needs more disk/mem/speed than host has
|
2005-01-12 00:50:32 +00:00
|
|
|
// - already sent a result for this WU
|
|
|
|
// - no app_version available
|
2004-09-10 23:03:13 +00:00
|
|
|
//
|
|
|
|
static int possibly_send_result(
|
|
|
|
DB_RESULT& result,
|
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss
|
2004-09-10 23:03:13 +00:00
|
|
|
) {
|
|
|
|
DB_WORKUNIT wu;
|
|
|
|
DB_RESULT result2;
|
|
|
|
int retval, count;
|
|
|
|
char buf[256];
|
|
|
|
APP* app;
|
|
|
|
APP_VERSION* avp;
|
|
|
|
|
2005-02-02 22:58:46 +00:00
|
|
|
retval = wu.lookup_id(result.workunitid);
|
|
|
|
if (retval) return retval;
|
|
|
|
|
|
|
|
if (!wu_is_feasible(wu, sreq, reply)) {
|
|
|
|
return ERR_INSUFFICIENT_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2004-09-10 23:03:13 +00:00
|
|
|
if (config.one_result_per_user_per_wu) {
|
|
|
|
sprintf(buf, "where userid=%d and workunitid=%d", reply.user.id, wu.id);
|
|
|
|
retval = result2.count(count, buf);
|
|
|
|
if (retval) return retval;
|
2005-01-12 00:50:32 +00:00
|
|
|
if (count > 0) return ERR_WU_USER_RULE;
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
retval = get_app_version(
|
2005-01-31 23:20:49 +00:00
|
|
|
wu, app, avp, sreq, reply, platform, ss
|
2004-09-10 23:03:13 +00:00
|
|
|
);
|
|
|
|
if (retval) return retval;
|
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
return add_result_to_reply(result, wu, reply, platform, app, avp);
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
|
|
|
|
2005-01-12 10:46:44 +00:00
|
|
|
// returns true if the work generator can not make more work for this
|
|
|
|
// file, false if it can.
|
|
|
|
//
|
2005-01-31 23:20:49 +00:00
|
|
|
static bool work_generation_over(char *filename) {
|
2005-01-12 10:46:44 +00:00
|
|
|
char fullpath[512];
|
|
|
|
sprintf(fullpath, "../locality_scheduling/no_work_available/%s", filename);
|
|
|
|
return boinc_file_exists(fullpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
// returns zero on success, nonzero if didn't touch file
|
2005-01-31 23:20:49 +00:00
|
|
|
//
|
2005-01-12 10:46:44 +00:00
|
|
|
int touch_file(char *path) {
|
|
|
|
FILE *fp;
|
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
if (boinc_file_exists(path)) {
|
2005-01-12 10:46:44 +00:00
|
|
|
return 0;
|
2005-01-31 23:20:49 +00:00
|
|
|
}
|
2005-01-12 10:46:44 +00:00
|
|
|
|
|
|
|
if ((fp=fopen(path, "w"))) {
|
2005-01-31 23:20:49 +00:00
|
|
|
fclose(fp);
|
|
|
|
return 0;
|
2005-01-12 10:46:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
// Ask the WU generator to make more WUs for this file.
|
2005-01-11 05:18:34 +00:00
|
|
|
// Returns nonzero if can't make more work.
|
|
|
|
// Returns zero if it *might* have made more work
|
|
|
|
// (no way to be sure if it suceeded).
|
2005-01-09 06:26:37 +00:00
|
|
|
//
|
2005-01-11 05:18:34 +00:00
|
|
|
int make_more_work_for_file(char* filename) {
|
2005-01-10 22:22:00 +00:00
|
|
|
char fullpath[512];
|
2005-01-09 06:26:37 +00:00
|
|
|
|
2005-01-12 10:46:44 +00:00
|
|
|
if (work_generation_over(filename)) {
|
2005-01-11 05:18:34 +00:00
|
|
|
// since we found this file, it means that no work remains for this WU.
|
|
|
|
// So give up trying to interact with the WU generator.
|
2005-01-09 06:26:37 +00:00
|
|
|
log_messages.printf(
|
|
|
|
SCHED_MSG_LOG::DEBUG,
|
2005-01-12 10:46:44 +00:00
|
|
|
"work generator says no work remaining for file %s\n", filename
|
2005-01-09 06:26:37 +00:00
|
|
|
);
|
2005-01-11 05:18:34 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2005-01-31 23:20:49 +00:00
|
|
|
|
2005-01-11 05:18:34 +00:00
|
|
|
// open and touch a file in the need_work/
|
|
|
|
// directory as a way of indicating that we need work for this file.
|
|
|
|
// If this operation fails, don't worry or tarry!
|
|
|
|
//
|
|
|
|
sprintf(fullpath, "../locality_scheduling/need_work/%s", filename);
|
2005-01-12 10:46:44 +00:00
|
|
|
if (touch_file(fullpath)) {
|
2005-01-11 05:18:34 +00:00
|
|
|
log_messages.printf(
|
|
|
|
SCHED_MSG_LOG::CRITICAL,
|
2005-01-12 01:21:45 +00:00
|
|
|
"unable to touch %s\n", fullpath
|
2005-01-11 05:18:34 +00:00
|
|
|
);
|
|
|
|
return -1;
|
2005-01-09 06:26:37 +00:00
|
|
|
}
|
2005-01-12 10:46:44 +00:00
|
|
|
|
2005-01-11 05:18:34 +00:00
|
|
|
log_messages.printf(
|
|
|
|
SCHED_MSG_LOG::DEBUG,
|
2005-01-12 10:46:44 +00:00
|
|
|
"touched %s: need work for file %s\n", fullpath, filename
|
2005-01-11 05:18:34 +00:00
|
|
|
);
|
2005-01-12 00:50:32 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get a randomly-chosen filename in the working set.
|
|
|
|
//
|
|
|
|
static int get_working_set_filename(char *filename) {
|
|
|
|
glob_t globbuf;
|
|
|
|
int retglob, random_file;
|
|
|
|
char *last_slash;
|
|
|
|
const char *pattern = "../locality_scheduling/work_available/*";
|
|
|
|
|
|
|
|
retglob=glob(pattern, GLOB_ERR|GLOB_NOSORT|GLOB_NOCHECK, NULL, &globbuf);
|
|
|
|
|
|
|
|
if (retglob || !globbuf.gl_pathc) {
|
|
|
|
// directory did not exist or is not readable
|
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (globbuf.gl_pathc==1 && !strcmp(pattern, globbuf.gl_pathv[0])) {
|
|
|
|
// directory was empty
|
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Choose a file at random.
|
|
|
|
random_file = rand() % globbuf.gl_pathc;
|
|
|
|
|
|
|
|
// remove trailing slash from randomly-selected file path
|
|
|
|
last_slash = rindex(globbuf.gl_pathv[random_file], '/');
|
|
|
|
if (!last_slash || *last_slash=='\0' || *(++last_slash)=='\0') {
|
|
|
|
// no trailing slash found, or it's a directory name
|
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(filename, last_slash);
|
|
|
|
globfree(&globbuf);
|
|
|
|
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"get_working_set_filename(): returning %s\n", filename
|
|
|
|
);
|
|
|
|
|
2005-01-10 01:40:14 +00:00
|
|
|
return 0;
|
2005-01-12 00:50:32 +00:00
|
|
|
|
|
|
|
error_exit:
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
|
|
|
|
"get_working_set_filename(): pattern %s not found\n", pattern
|
|
|
|
);
|
|
|
|
|
|
|
|
globfree(&globbuf);
|
|
|
|
return 1;
|
2005-01-09 06:26:37 +00:00
|
|
|
}
|
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
static void flag_for_possible_removal(char* filename) {
|
2005-01-12 00:50:32 +00:00
|
|
|
char path[256];
|
|
|
|
sprintf(path, "../locality_scheduling/working_set_removal/%s", filename);
|
2005-01-12 10:46:44 +00:00
|
|
|
touch_file(path);
|
|
|
|
return;
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The client has (or will soon have) the given file.
|
|
|
|
// Try to send it results that use that file.
|
|
|
|
// If don't get any the first time,
|
|
|
|
// trigger the work generator, then try again.
|
2004-09-10 23:03:13 +00:00
|
|
|
//
|
|
|
|
static int send_results_for_file(
|
|
|
|
char* filename,
|
|
|
|
int& nsent,
|
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss,
|
2005-01-12 00:50:32 +00:00
|
|
|
bool in_working_set
|
2004-09-10 23:03:13 +00:00
|
|
|
) {
|
2005-01-11 05:18:34 +00:00
|
|
|
DB_RESULT result, prev_result;
|
2005-01-12 00:50:32 +00:00
|
|
|
char buf[256], query[1024];
|
2005-01-13 17:33:29 +00:00
|
|
|
int i, maxid, retval_max, retval_lookup;
|
2004-09-10 23:03:13 +00:00
|
|
|
|
2005-01-13 17:33:29 +00:00
|
|
|
// find largest ID of results already sent to this user for this
|
|
|
|
// file, if any. Any result that is sent will have userid field
|
|
|
|
// set, so unsent results can not be returned by this query.
|
2005-01-11 05:18:34 +00:00
|
|
|
//
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#ifdef USE_REGEXP
|
2005-01-11 05:18:34 +00:00
|
|
|
sprintf(buf, "where userid=%d and name like '%s__%%'",
|
|
|
|
reply.user.id, filename
|
|
|
|
);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#else
|
|
|
|
sprintf(buf, "where userid=%d and name>'%s__' and name<'%s__~'",
|
2005-01-31 23:20:49 +00:00
|
|
|
reply.user.id, filename, filename
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
);
|
|
|
|
#endif
|
2005-01-13 17:33:29 +00:00
|
|
|
retval_max = result.max_id(maxid, buf);
|
|
|
|
if (retval_max) {
|
2005-01-12 00:50:32 +00:00
|
|
|
prev_result.id = 0;
|
|
|
|
} else {
|
2005-01-13 17:33:29 +00:00
|
|
|
retval_lookup = prev_result.lookup_id(maxid);
|
|
|
|
if (retval_lookup) return retval_lookup;
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
2005-01-11 05:18:34 +00:00
|
|
|
|
2004-09-10 23:03:13 +00:00
|
|
|
nsent = 0;
|
2005-01-09 06:26:37 +00:00
|
|
|
for (i=0; i<100; i++) { // avoid infinite loop
|
2005-01-13 17:33:29 +00:00
|
|
|
int query_retval;
|
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
if (!reply.work_needed()) break;
|
2005-01-12 21:04:25 +00:00
|
|
|
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
2005-01-13 17:33:29 +00:00
|
|
|
"in_send_results_for_file(%s, %d) prev_result.id=%d\n", filename, i, prev_result.id
|
2005-01-12 21:04:25 +00:00
|
|
|
);
|
2005-01-12 00:50:32 +00:00
|
|
|
|
2005-01-11 05:18:34 +00:00
|
|
|
// find unsent result with next larger ID than previous largest ID
|
|
|
|
//
|
2005-01-12 00:50:32 +00:00
|
|
|
if (config.one_result_per_user_per_wu && prev_result.id) {
|
2005-01-11 05:18:34 +00:00
|
|
|
|
|
|
|
// if one result per user per WU, insist on different WUID too
|
|
|
|
//
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#ifdef USE_REGEXP
|
2005-01-11 05:18:34 +00:00
|
|
|
sprintf(query,
|
|
|
|
"where name like '%s__%%' and id>%d and workunitid<>%d and server_state=%d order by id limit 1 ",
|
|
|
|
filename, prev_result.id, prev_result.workunitid, RESULT_SERVER_STATE_UNSENT
|
|
|
|
);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#else
|
|
|
|
sprintf(query,
|
|
|
|
"where name>'%s__' and name<'%s__~' and id>%d and workunitid<>%d and server_state=%d order by id limit 1 ",
|
|
|
|
filename, filename, prev_result.id, prev_result.workunitid, RESULT_SERVER_STATE_UNSENT
|
|
|
|
);
|
|
|
|
#endif
|
2005-01-11 05:18:34 +00:00
|
|
|
} else {
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#ifdef USE_REGEXP
|
2005-01-11 05:18:34 +00:00
|
|
|
sprintf(query,
|
|
|
|
"where name like '%s__%%' and id>%d and server_state=%d order by id limit 1 ",
|
|
|
|
filename, prev_result.id, RESULT_SERVER_STATE_UNSENT
|
|
|
|
);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#else
|
|
|
|
sprintf(query,
|
|
|
|
"where name>'%s__' and name<'%s__~' and id>%d and server_state=%d order by id limit 1 ",
|
|
|
|
filename, filename, prev_result.id, RESULT_SERVER_STATE_UNSENT
|
|
|
|
);
|
|
|
|
#endif
|
2005-01-09 22:57:59 +00:00
|
|
|
}
|
2005-01-08 20:55:49 +00:00
|
|
|
|
2005-01-13 17:33:29 +00:00
|
|
|
// Use a transaction so that if we get a result,
|
|
|
|
// someone else doesn't send it before we do
|
|
|
|
//
|
|
|
|
boinc_db.start_transaction();
|
2005-01-12 21:04:25 +00:00
|
|
|
|
2005-01-13 17:33:29 +00:00
|
|
|
query_retval = result.lookup(query);
|
|
|
|
|
|
|
|
if (query_retval) {
|
2005-01-31 23:20:49 +00:00
|
|
|
int make_work_retval;
|
|
|
|
|
|
|
|
// no unsent results are available for this file
|
|
|
|
//
|
|
|
|
boinc_db.commit_transaction();
|
|
|
|
|
|
|
|
// see if no more work remains to be made for this file,
|
|
|
|
// or if an attempt to make more work fails.
|
|
|
|
//
|
|
|
|
make_work_retval=make_more_work_for_file(filename);
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"make_more_work_for_file(%s, %d)=%d\n", filename, i, make_work_retval
|
2005-01-13 17:33:29 +00:00
|
|
|
);
|
2005-01-31 23:20:49 +00:00
|
|
|
|
|
|
|
if (make_work_retval) {
|
|
|
|
// can't make any more work for this file
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
if (config.one_result_per_user_per_wu) {
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// do an EXPENSIVE db query
|
|
|
|
char query[256];
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#ifdef USE_REGEXP
|
2005-01-31 23:20:49 +00:00
|
|
|
sprintf(query,
|
|
|
|
"where server_state=%d and name like '%s__%%' limit 1",
|
|
|
|
RESULT_SERVER_STATE_UNSENT, filename
|
|
|
|
);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#else
|
2005-01-31 23:20:49 +00:00
|
|
|
sprintf(query,
|
|
|
|
"where server_state=%d and name>'%s__' and name<'%s__~' limit 1",
|
|
|
|
RESULT_SERVER_STATE_UNSENT, filename, filename
|
|
|
|
);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
#endif
|
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// re-using result -- do I need to clear it?
|
|
|
|
if (!result.lookup(query)) {
|
|
|
|
// some results remain -- but they are not suitable
|
|
|
|
// for us because they must be for a WU that we have
|
|
|
|
// already looked at.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} // config.one_result_per_user_per_wu
|
|
|
|
|
|
|
|
// arrive here if and only if there exist no further
|
|
|
|
// unsent results for this file.
|
|
|
|
flag_for_possible_removal(filename);
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"No remaining work for file %s (%d), flagging for removal\n", filename, i
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
} // make_work_retval
|
|
|
|
|
|
|
|
// if the user has not configured us to wait and try
|
|
|
|
// again, we are finished.
|
|
|
|
//
|
|
|
|
if (!config.locality_scheduling_wait_period) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// wait a bit and try again to find a suitable unsent result
|
|
|
|
sleep(config.locality_scheduling_wait_period);
|
|
|
|
|
|
|
|
} // query_retval
|
|
|
|
else {
|
|
|
|
int retval_send;
|
|
|
|
|
|
|
|
// we found an unsent result, so try sending it. This
|
|
|
|
// *should* always work.
|
|
|
|
//
|
2005-01-13 17:33:29 +00:00
|
|
|
retval_send = possibly_send_result(
|
2005-01-31 23:20:49 +00:00
|
|
|
result, sreq, reply, platform, ss
|
2005-01-09 06:26:37 +00:00
|
|
|
);
|
2005-01-12 00:50:32 +00:00
|
|
|
boinc_db.commit_transaction();
|
|
|
|
|
|
|
|
// if no app version, give up completely
|
|
|
|
//
|
2005-01-13 17:33:29 +00:00
|
|
|
if (retval_send == ERR_NO_APP_VERSION) return retval_send;
|
2005-01-11 05:18:34 +00:00
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
// if we couldn't send it for other reason, something's wacky;
|
2005-01-13 17:33:29 +00:00
|
|
|
// print a message, but keep on looking.
|
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// David, this is NOT wacky. Consider the following
|
|
|
|
// scenario: WU A has result 1 and WU B has result 2.
|
|
|
|
// These are both sent to a host. Some time later, result
|
|
|
|
// 1 fails and the transitioner creates a new result,
|
|
|
|
// result 3 for WU A. Then the host requests a new
|
|
|
|
// result. The maximum result already sent to the host is
|
|
|
|
// 2. The next unsent result (sorted by ID) is #3. But
|
|
|
|
// since it is for WU A, and since the host has already
|
|
|
|
// gotten a result for WU A, it's infeasible. So I think
|
|
|
|
// this is only wacky if !one_wu_per_result_per_host.
|
|
|
|
if (!retval_send) {
|
|
|
|
nsent++;
|
|
|
|
} else if (!config.one_result_per_user_per_wu) {
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
|
|
|
|
"Database inconsistency? possibly_send_result(%d) failed for [RESULT#%d], returning %d\n",
|
|
|
|
i, result.id, retval_send
|
2005-01-12 00:50:32 +00:00
|
|
|
);
|
2005-01-13 17:33:29 +00:00
|
|
|
}
|
2005-01-13 23:24:49 +00:00
|
|
|
|
2005-01-11 05:18:34 +00:00
|
|
|
prev_result = result;
|
2005-01-13 23:24:49 +00:00
|
|
|
|
2005-01-13 17:33:29 +00:00
|
|
|
} // query_retval
|
2005-01-13 23:24:49 +00:00
|
|
|
|
2005-01-13 17:33:29 +00:00
|
|
|
} // loop over 0<i<100
|
2004-09-10 23:03:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
// Find a file with work, and send.
|
|
|
|
// This is guaranteed to send work if ANY is available for this user.
|
|
|
|
// However, it ignores the working set,
|
|
|
|
// and should be done only if we fail to send work from the working set.
|
2005-01-11 20:33:19 +00:00
|
|
|
//
|
2005-01-12 00:50:32 +00:00
|
|
|
// logic:
|
2005-01-31 11:45:45 +00:00
|
|
|
// min_resultname = ""
|
2005-01-11 20:33:19 +00:00
|
|
|
// loop
|
2005-01-31 11:45:45 +00:00
|
|
|
// R = first unsent result where filename>min_resultname order by filename
|
2005-01-11 20:33:19 +00:00
|
|
|
// // order by filename implies order by ID
|
|
|
|
// send_results_for_file(R.filename)
|
|
|
|
// // this skips disqualified results
|
2005-01-31 11:45:45 +00:00
|
|
|
// min_resultname = R.filename;
|
2004-09-10 23:03:13 +00:00
|
|
|
//
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
static int send_new_file_work_deterministic_seeded(
|
2004-09-10 23:03:13 +00:00
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss, int& nsent, char *start_f, char *end_f
|
2004-09-10 23:03:13 +00:00
|
|
|
) {
|
|
|
|
DB_RESULT result;
|
2005-01-31 11:45:45 +00:00
|
|
|
char filename[256], min_resultname[256], query[1024];
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
int retval;
|
2004-09-10 23:03:13 +00:00
|
|
|
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
2005-01-31 11:45:45 +00:00
|
|
|
"send_new_file_work_deterministic_seeded() start=%s end=%s\n", start_f, end_f?end_f:"+Inf");
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 11:45:45 +00:00
|
|
|
strcpy(min_resultname, start_f);
|
2005-01-12 00:50:32 +00:00
|
|
|
while (1) {
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// are we done with the search yet?
|
|
|
|
if (end_f && strcmp(min_resultname, end_f)>=0)
|
|
|
|
break;
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-09 22:57:59 +00:00
|
|
|
sprintf(query,
|
2005-01-11 20:33:19 +00:00
|
|
|
"where server_state=%d and name>'%s' order by name limit 1",
|
2005-01-31 11:45:45 +00:00
|
|
|
RESULT_SERVER_STATE_UNSENT, min_resultname
|
2005-01-11 05:18:34 +00:00
|
|
|
);
|
2005-01-11 20:33:19 +00:00
|
|
|
retval = result.lookup(query);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
if (retval) break; // no more unsent results or at the end of the filenames, return -1
|
2005-01-12 00:50:32 +00:00
|
|
|
retval = extract_filename(result.name, filename);
|
2005-01-12 21:04:25 +00:00
|
|
|
if (retval) return retval; // not locality scheduled, now what???
|
2005-01-13 17:33:29 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
2005-01-13 17:33:29 +00:00
|
|
|
"send_new_file_work_deterministic will try filename %s\n", filename
|
|
|
|
);
|
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
retval = send_results_for_file(
|
2005-01-31 23:20:49 +00:00
|
|
|
filename, nsent, sreq, reply, platform, ss, false
|
2004-09-10 23:03:13 +00:00
|
|
|
);
|
2005-01-31 11:45:45 +00:00
|
|
|
if (nsent>0) break;
|
|
|
|
// construct a name which is lexically greater than the name of any result
|
|
|
|
// which uses this file.
|
|
|
|
sprintf(min_resultname, "%s__~", filename);
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
2005-01-12 00:50:32 +00:00
|
|
|
return 0;
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
|
|
|
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
|
|
|
// Returns 0 if this has sent additional new work. Returns non-zero
|
|
|
|
// if it has not sent any new work.
|
|
|
|
//
|
|
|
|
static int send_new_file_work_deterministic(
|
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
) {
|
2005-01-31 23:20:49 +00:00
|
|
|
char start_filename[256];
|
|
|
|
int getfile_retval, nsent=0;
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// get random filename as starting point for deterministic search
|
|
|
|
if ((getfile_retval = get_working_set_filename(start_filename))) {
|
|
|
|
strcpy(start_filename, "");
|
|
|
|
}
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// start deterministic search with randomly chosen filename, go to
|
|
|
|
// lexical maximum
|
|
|
|
send_new_file_work_deterministic_seeded(sreq, reply, platform, ss, nsent, start_filename, NULL);
|
|
|
|
if (nsent) {
|
|
|
|
return 0;
|
|
|
|
}
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// continue deterministic search at lexically first possible
|
|
|
|
// filename, continue to randomly choosen one
|
|
|
|
if (!getfile_retval && reply.work_needed()) {
|
|
|
|
send_new_file_work_deterministic_seeded(sreq, reply, platform, ss, nsent, "", start_filename);
|
|
|
|
if (nsent) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
return 1;
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
static int send_new_file_work_working_set(
|
2004-09-10 23:03:13 +00:00
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss
|
2004-09-10 23:03:13 +00:00
|
|
|
) {
|
2005-01-12 00:50:32 +00:00
|
|
|
char filename[256];
|
|
|
|
int retval, nsent;
|
|
|
|
|
|
|
|
retval = get_working_set_filename(filename);
|
|
|
|
if (retval) return retval;
|
2005-01-13 17:33:29 +00:00
|
|
|
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"send_new_file_working_set will try filename %s\n", filename
|
|
|
|
);
|
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
return send_results_for_file(
|
2005-01-31 23:20:49 +00:00
|
|
|
filename, nsent, sreq, reply, platform, ss, true
|
2005-01-12 00:50:32 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
// prototype
|
|
|
|
static int send_old_work(
|
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss, int timeout);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
// The host doesn't have any files for which work is available.
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
// Pick new file to send. Returns nonzero if no work is available.
|
2005-01-12 00:50:32 +00:00
|
|
|
//
|
|
|
|
static int send_new_file_work(
|
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss
|
2005-01-12 00:50:32 +00:00
|
|
|
) {
|
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
while (reply.work_needed()) {
|
|
|
|
int random_time=6*3600+rand()%(6*3600);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// send work that's been hanging around the queue for more than 6
|
|
|
|
// to 12 hours
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"send_new_file_work() trying to send results created > %.1f hours ago\n", ((double)random_time)/3600.0);
|
|
|
|
send_old_work(sreq, reply, platform, ss, random_time);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
if (reply.work_needed()) {
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"send_new_file_work() trying to send from working set\n"
|
|
|
|
);
|
|
|
|
send_new_file_work_working_set(sreq, reply, platform, ss);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reply.work_needed()) {
|
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"send_new_file_work() trying deterministic method\n"
|
|
|
|
);
|
|
|
|
if (send_new_file_work_deterministic(sreq, reply, platform, ss)) {
|
|
|
|
// if no work remains at all,
|
|
|
|
// we learn it here and return nonzero.
|
|
|
|
//
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
2005-01-31 23:20:49 +00:00
|
|
|
return 0;
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
|
|
|
|
2005-01-12 10:46:44 +00:00
|
|
|
|
|
|
|
// DAVID, this is missing a return value! Am I right that this will
|
|
|
|
// also eventually move 'non locality' work through and out of the
|
|
|
|
// system?
|
2005-01-12 00:50:32 +00:00
|
|
|
static int send_old_work(
|
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss, int timeout
|
2005-01-12 00:50:32 +00:00
|
|
|
) {
|
|
|
|
char buf[1024], filename[256];
|
2005-01-12 10:46:44 +00:00
|
|
|
int retval, extract_retval, nsent;
|
2005-01-12 00:50:32 +00:00
|
|
|
DB_RESULT result;
|
2004-09-10 23:03:13 +00:00
|
|
|
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
int cutoff = time(0) - timeout;
|
2005-01-12 00:50:32 +00:00
|
|
|
boinc_db.start_transaction();
|
|
|
|
sprintf(buf, "where server_state=%d and create_time<%d limit 1",
|
|
|
|
RESULT_SERVER_STATE_UNSENT, cutoff
|
|
|
|
);
|
|
|
|
retval = result.lookup(buf);
|
|
|
|
if (!retval) {
|
2005-01-31 23:20:49 +00:00
|
|
|
retval = possibly_send_result(result, sreq, reply, platform, ss);
|
2005-01-12 00:50:32 +00:00
|
|
|
boinc_db.commit_transaction();
|
|
|
|
if (!retval) {
|
2005-01-31 23:20:49 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
|
|
|
"send_old_work(%s) send laggard result [RESULT#%d]\n", result.name, result.id
|
|
|
|
);
|
|
|
|
extract_retval=extract_filename(result.name, filename);
|
2005-01-12 10:46:44 +00:00
|
|
|
if (!extract_retval) {
|
|
|
|
send_results_for_file(
|
2005-01-31 23:20:49 +00:00
|
|
|
filename, nsent, sreq, reply, platform, ss, false
|
2005-01-12 10:46:44 +00:00
|
|
|
);
|
2005-01-31 23:20:49 +00:00
|
|
|
} else {
|
|
|
|
// David, is this right? Is this the only place in
|
|
|
|
// the locality scheduler that non-locality work //
|
|
|
|
// gets done?
|
2005-01-12 10:46:44 +00:00
|
|
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
2005-01-31 23:20:49 +00:00
|
|
|
"Note: sent NON-LOCALITY result %s\n", result.name
|
|
|
|
);
|
|
|
|
}
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
2004-09-10 23:03:13 +00:00
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
} else {
|
|
|
|
boinc_db.commit_transaction();
|
|
|
|
}
|
2005-01-12 10:46:44 +00:00
|
|
|
// DAVID, YOU CHANGED THIS FROM VOID TO INT. IS THIS THE RIGHT
|
|
|
|
// RETURN VAL? You should probably use the return value from
|
|
|
|
// sent_results_for_file as well.
|
|
|
|
return retval;
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
2005-01-10 01:40:14 +00:00
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
void send_work_locality(
|
|
|
|
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
2005-01-31 23:20:49 +00:00
|
|
|
SCHED_SHMEM& ss
|
2005-01-12 00:50:32 +00:00
|
|
|
) {
|
2005-01-31 11:45:45 +00:00
|
|
|
int i;
|
2005-01-12 10:46:44 +00:00
|
|
|
int nsent, nfiles, j, k;
|
2004-09-10 23:03:13 +00:00
|
|
|
|
2005-01-31 11:45:45 +00:00
|
|
|
// seed the random number generator
|
|
|
|
unsigned int seed=time(0)+getpid();
|
|
|
|
srand(seed);
|
|
|
|
|
2005-01-12 00:50:32 +00:00
|
|
|
nfiles = (int) sreq.file_infos.size();
|
2005-01-31 11:45:45 +00:00
|
|
|
for (i=0; i<nfiles; i++)
|
|
|
|
log_messages.printf(
|
|
|
|
SCHED_MSG_LOG::DEBUG,
|
|
|
|
"[HOST#%d]: has file %s\n", reply.host.id, sreq.file_infos[i].name
|
|
|
|
);
|
|
|
|
|
2005-01-12 21:04:25 +00:00
|
|
|
if (!nfiles)
|
|
|
|
nfiles=1;
|
2005-01-12 00:50:32 +00:00
|
|
|
j = rand()%nfiles;
|
|
|
|
|
|
|
|
// send old work if there is any
|
|
|
|
//
|
|
|
|
if (config.locality_scheduling_send_timeout) {
|
2005-01-31 23:20:49 +00:00
|
|
|
send_old_work(sreq, reply, platform, ss, config.locality_scheduling_send_timeout);
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// send work for existing files
|
|
|
|
//
|
2005-01-31 11:45:45 +00:00
|
|
|
for (i=0; i<(int)sreq.file_infos.size(); i++) {
|
2005-01-12 00:50:32 +00:00
|
|
|
k = (i+j)%nfiles;
|
2005-01-31 23:20:49 +00:00
|
|
|
if (!reply.work_needed()) break;
|
2005-01-12 00:50:32 +00:00
|
|
|
FILE_INFO& fi = sreq.file_infos[k];
|
|
|
|
send_results_for_file(
|
2005-01-31 23:20:49 +00:00
|
|
|
fi.name, nsent, sreq, reply, platform, ss, false
|
2005-01-12 00:50:32 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// if we couldn't send any work for this file, tell client to delete it
|
2004-09-10 23:03:13 +00:00
|
|
|
//
|
2005-01-12 00:50:32 +00:00
|
|
|
if (nsent == 0) {
|
|
|
|
reply.file_deletes.push_back(fi);
|
|
|
|
log_messages.printf(
|
|
|
|
SCHED_MSG_LOG::DEBUG,
|
2005-01-31 11:45:45 +00:00
|
|
|
"[HOST#%d]: delete file %s (not needed)\n", reply.host.id, fi.name
|
2005-01-12 00:50:32 +00:00
|
|
|
);
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
} // nsent==0
|
|
|
|
} // loop over files already on the host
|
2005-01-12 00:50:32 +00:00
|
|
|
|
|
|
|
// send new files if needed
|
|
|
|
//
|
2005-01-31 23:20:49 +00:00
|
|
|
if (reply.work_needed()) {
|
|
|
|
send_new_file_work(sreq, reply, platform, ss);
|
2005-01-12 00:50:32 +00:00
|
|
|
}
|
2004-09-10 23:03:13 +00:00
|
|
|
}
|
2004-12-08 00:40:19 +00:00
|
|
|
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
// Explanation of the logic of this scheduler:
|
|
|
|
|
|
|
|
// (1) If there is an (one) unsent result which is older than
|
|
|
|
// (1) config.locality_scheduling_send_timeout (7 days) and is
|
|
|
|
// (1) feasible for the host, sent it.
|
|
|
|
|
|
|
|
// (2) If we did send a result in the previous step, then send any
|
|
|
|
// (2) additional results that are feasible for the same input file.
|
|
|
|
|
|
|
|
// (3) If additional results are needed, step through input files on
|
|
|
|
// (3) the host. For each, if there are results that are feasible for
|
|
|
|
// (3) the host, send them. If there are no results that are feasible
|
|
|
|
// (3) for the host, delete the input file from the host.
|
|
|
|
|
|
|
|
// (4) If additional results are needed, and there is (one) unsent
|
|
|
|
// (4) result which is older than 2 hours and is feasible for the
|
|
|
|
// (4) host, send it.
|
|
|
|
|
|
|
|
// (5) If we did send a result in the previous step, then send any
|
|
|
|
// (5) additional results that are feasible for the same input file.
|
|
|
|
|
|
|
|
// (6) If additional results are needed, select an input file name at
|
|
|
|
// (6) random from the current input file working set advertised by
|
|
|
|
// (6) the WU generator. If there are results for this input file
|
|
|
|
// (6) that are feasible for this host, send them.
|
|
|
|
|
|
|
|
// (7) If additional results are needed, carry out an expensive,
|
|
|
|
// (7) deterministic search for ANY results that are feasible for the
|
|
|
|
// (7) host. This search starts from a random filename advertised by
|
|
|
|
// (7) the WU generator, but continues cyclicly to cover ALL results
|
|
|
|
// (7) for ALL files. If a feasible result is found, send it. Then
|
|
|
|
// (7) send any additional results that use the same input file. If
|
|
|
|
// (7) there are no feasible results for the host, we are finished:
|
|
|
|
// (7) exit.
|
|
|
|
|
|
|
|
// (8) If addtional results are needed, return to step 4 above.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_238cc1aec4 = "$Id$";
|
- Additional work on locality scheduling.
(a) make DB queries more efficient using name>'FILE__' and name<'FILE__~' rather than
name like 'FILE__%'
(b) Set 'no remaining work for this file' flag correctly by making a DB scan if needed.
One can show that this is the 'cheapest' reliable place to put this scan.
(c) Modify deterministic algorithm for finding unsent results so that instead of
starting with FILE="" and scanning forward over all files, it starts at a random
place in file space, scans cyclicly to the end, and then from "" to the start
point.
(d) Satisfy work request if possible. Don't terminate sending work until none left that
is feasible, or request satisfed.
(e) If a new file is needed, first pick file associated with unsent results which are more
than 2 hours old. Note: need to make this a user-configurable option, and add some
random +- slack.
For the record, here is the current locality scheduler logic.
I will update the docs once this is a bit better tested and
stable.
(1) If there is an (one) unsent result which is older than
(1) config.locality_scheduling_send_timeout (7 days) and is
(1) feasible for the host, sent it.
(2) If we did send a result in the previous step, then send any
(2) additional results that are feasible for the same input file.
(3) If additional results are needed, step through input files on
(3) the host. For each, if there are results that are feasible for
(3) the host, send them. If there are no results that are feasible
(3) for the host, delete the input file from the host.
(4) If additional results are needed, and there is (one) unsent
(4) result which is older than 2 hours and is feasible for the
(4) host, send it.
(5) If we did send a result in the previous step, then send any
(5) additional results that are feasible for the same input file.
(6) If additional results are needed, select an input file name at
(6) random from the current input file working set advertised by
(6) the WU generator. If there are results for this input file
(6) that are feasible for this host, send them.
(7) If additional results are needed, carry out an expensive,
(7) deterministic search for ANY results that are feasible for the
(7) host. This search starts from a random filename advertised by
(7) the WU generator, but continues cyclicly to cover ALL results
(7) for ALL files. If a feasible result is found, send it. Then
(7) send any additional results that use the same input file. If
(7) there are no feasible results for the host, we are finished:
(7) exit.
(8) If addtional results are needed, return to step 4 above.
svn path=/trunk/boinc/; revision=5129
2005-01-17 19:20:56 +00:00
|
|
|
|