mirror of https://github.com/BOINC/boinc.git
- API: remove BOINC_OPTIONS::worker_thread_stack_size
- web: check whether to show profile in separate function from displaying profile; eliminate double headers - scheduler: finish purge of redundant arguments svn path=/trunk/boinc/; revision=16726
This commit is contained in:
parent
3fe331944e
commit
312ffba708
|
@ -30,6 +30,12 @@ extern "C" {
|
|||
#endif
|
||||
typedef struct BOINC_OPTIONS {
|
||||
// the following are booleans, implemented as ints for portability
|
||||
int backwards_compatible_graphics;
|
||||
// V6 apps should set this so that "Show Graphics" will work
|
||||
// with pre-V6 clients
|
||||
int normal_thread_priority;
|
||||
// run app at normal thread priority on Win.
|
||||
// (default is idle priority)
|
||||
int main_program;
|
||||
// this is the main program, so
|
||||
// - lock a lock file in the slot directory
|
||||
|
@ -48,14 +54,6 @@ typedef struct BOINC_OPTIONS {
|
|||
// if heartbeat fail, or get process control msg, take
|
||||
// direction action (exit, suspend, resume).
|
||||
// Otherwise just set flag in BOINC status
|
||||
int worker_thread_stack_size;
|
||||
// if nonzero, the worker thread stack size limit
|
||||
int backwards_compatible_graphics;
|
||||
// V6 apps should set this so that "Show Graphics" will work
|
||||
// with pre-V6 clients
|
||||
int normal_thread_priority;
|
||||
// run app at normal thread priority on Win.
|
||||
// (default is idle priority)
|
||||
} BOINC_OPTIONS;
|
||||
|
||||
typedef struct BOINC_STATUS {
|
||||
|
@ -146,7 +144,6 @@ inline void boinc_options_defaults(BOINC_OPTIONS& b) {
|
|||
b.handle_process_control = 1;
|
||||
b.send_status_msgs = 1;
|
||||
b.direct_process_action = 1;
|
||||
b.worker_thread_stack_size = 0;
|
||||
b.backwards_compatible_graphics = 1;
|
||||
b.normal_thread_priority = 0;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
// and thus can be put in a shared library,
|
||||
// separate from the application.
|
||||
|
||||
// DEPRECATED - use separate graphics app
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
|
|
@ -10271,3 +10271,19 @@ Charlie 17 Dec 2008
|
|||
boinc.xcodeproj/
|
||||
project.pbxproj
|
||||
|
||||
David 19 Dec 2008
|
||||
- API: remove BOINC_OPTIONS::worker_thread_stack_size
|
||||
- web: check whether to show profile in separate function
|
||||
from displaying profile; eliminate double headers
|
||||
- scheduler: finish purge of redundant arguments
|
||||
|
||||
api/
|
||||
boinc_api.h
|
||||
grephics_impl.cpp
|
||||
html/
|
||||
inc/
|
||||
profile.inc
|
||||
user/
|
||||
view_profile.php
|
||||
sched/
|
||||
(many files)
|
||||
|
|
|
@ -20,9 +20,11 @@ With NVIDIA's assistance,
|
|||
some BOINC-based projects have applications that run on NVIDIA GPUs using CUDA.
|
||||
<b>These applications run from 2X to 10X faster than the CPU-only version.
|
||||
We urge BOINC participants to use them if possible.</b>
|
||||
<p>
|
||||
Just follow these instructions:
|
||||
<p>
|
||||
(Note: CUDA apps are supported only on Windows and Linux;
|
||||
Mac OS X support is coming soon.)
|
||||
<p>
|
||||
<b>1) Check whether your computer has a CUDA-capable GPU</b>
|
||||
<dd>
|
||||
CUDA programs work on most newer NVIDIA GPUs.
|
||||
|
|
|
@ -183,6 +183,19 @@ function get_profile_summary($profile) {
|
|||
return $summary;
|
||||
}
|
||||
|
||||
function check_whether_to_show_profile($user, $logged_in_user) {
|
||||
$min_credit = parse_config(get_config(), "<profile_min_credit>");
|
||||
if (!$logged_in_user && $min_credit && $user->expavg_credit < $min_credit ) {
|
||||
error_page(
|
||||
"To prevent spam, profiles of users with an average credit of less than $min_credit are displayed only to logged-in users. We apologize for this inconvenience."
|
||||
);
|
||||
}
|
||||
if (is_banished($user)) {
|
||||
error_page("User is banished");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Displays a user's profile (if they have one);
|
||||
// $screen_mode is set if we're in the administrative profile-screening page,
|
||||
// in which case we show everything
|
||||
|
@ -192,23 +205,12 @@ function show_profile($user, $logged_in_user, $screen_mode = false) {
|
|||
BoincForumPrefs::lookup($user);
|
||||
$profile = BoincProfile::lookup("userid = $user->id");
|
||||
if (!$profile) {
|
||||
error_page("No user profile exists for that user ID.");
|
||||
row1("No profile exists for that user ID.");
|
||||
$user->update("has_profile = 0");
|
||||
return;
|
||||
}
|
||||
|
||||
$is_logged_in = isset($logged_in_user);
|
||||
|
||||
$can_edit = isset($logged_in_user) && $logged_in_user && $user->id == $logged_in_user->id;
|
||||
|
||||
$min_credit = parse_config(get_config(), "<profile_min_credit>");
|
||||
if ((!$is_logged_in) && $min_credit && $user->expavg_credit < $min_credit ) {
|
||||
error_page(
|
||||
"To prevent spam, profiles of users with an average credit of less than $min_credit will only be displayed to users who are logged in to their accounts. We appologize for this inconvenience."
|
||||
);
|
||||
}
|
||||
if (is_banished($user)) {
|
||||
error_page("User is banished");
|
||||
}
|
||||
$can_edit = $logged_in_user && $user->id == $logged_in_user->id;
|
||||
|
||||
if ($can_edit) {
|
||||
row1("<a href=create_profile.php>Edit your profile</a>");
|
||||
|
|
|
@ -28,12 +28,16 @@ if (!$user->has_profile) {
|
|||
}
|
||||
|
||||
$logged_in_user = get_logged_in_user(false);
|
||||
|
||||
check_whether_to_show_profile($user, $logged_in_user);
|
||||
|
||||
$caching = false;
|
||||
if (!$logged_in_user) {
|
||||
$caching = true;
|
||||
$cache_args = "userid=$userid";
|
||||
start_cache(USER_PROFILE_TTL, $cache_args);
|
||||
}
|
||||
|
||||
page_head("Profile: $user->name");
|
||||
start_table();
|
||||
echo "<tr><td valign=top>";
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -97,9 +97,7 @@ static void usage(char* p) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
void debug_sched(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& sreply, const char *trigger
|
||||
) {
|
||||
void debug_sched(const char *trigger) {
|
||||
char tmpfilename[256];
|
||||
#ifndef _USING_FCGI_
|
||||
FILE *fp;
|
||||
|
@ -111,7 +109,9 @@ void debug_sched(
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf(tmpfilename, "sched_reply_%06d_%06d", sreq.hostid, sreq.rpc_seqno);
|
||||
sprintf(tmpfilename,
|
||||
"sched_reply_%06d_%06d", g_request->hostid, g_request->rpc_seqno
|
||||
);
|
||||
// use _XXXXXX if you want random filenames rather than
|
||||
// deterministic mkstemp(tmpfilename);
|
||||
|
||||
|
@ -132,10 +132,12 @@ void debug_sched(
|
|||
"Found %s, so writing %s\n", trigger, tmpfilename
|
||||
);
|
||||
|
||||
sreply.write(fp, sreq);
|
||||
g_reply->write(fp, *g_request);
|
||||
fclose(fp);
|
||||
|
||||
sprintf(tmpfilename, "sched_request_%06d_%06d", sreq.hostid, sreq.rpc_seqno);
|
||||
sprintf(tmpfilename,
|
||||
"sched_request_%06d_%06d", g_request->hostid, g_request->rpc_seqno
|
||||
);
|
||||
#ifndef _USING_FCGI_
|
||||
fp=fopen(tmpfilename, "w");
|
||||
#else
|
||||
|
@ -153,7 +155,7 @@ void debug_sched(
|
|||
"Found %s, so writing %s\n", trigger, tmpfilename
|
||||
);
|
||||
|
||||
sreq.write(fp);
|
||||
g_request->write(fp);
|
||||
fclose(fp);
|
||||
|
||||
return;
|
||||
|
|
|
@ -69,6 +69,4 @@ extern bool mark_jobs_done;
|
|||
// (for debugging/testing)
|
||||
|
||||
extern int open_database();
|
||||
extern void debug_sched(
|
||||
SCHEDULER_REQUEST&, SCHEDULER_REPLY&, const char *trigger
|
||||
);
|
||||
extern void debug_sched(const char *trigger);
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
#endif
|
||||
|
||||
// Make a pass through the wu/results array, sending work.
|
||||
// If reply.wreq.infeasible_only is true,
|
||||
// If g_wreq->infeasible_only is true,
|
||||
// send only results that were previously infeasible for some host
|
||||
//
|
||||
void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
||||
void scan_work_array() {
|
||||
int i, j, retval, n, rnd_off, last_retval=0;;
|
||||
WORKUNIT wu;
|
||||
DB_RESULT result;
|
||||
|
@ -54,7 +54,7 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
rnd_off = rand() % ssp->max_wu_results;
|
||||
for (j=0; j<ssp->max_wu_results; j++) {
|
||||
i = (j+rnd_off) % ssp->max_wu_results;
|
||||
if (!work_needed(sreq, reply, false)) break;
|
||||
if (!work_needed(false)) break;
|
||||
|
||||
WU_RESULT& wu_result = ssp->wu_results[i];
|
||||
|
||||
|
@ -71,13 +71,13 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
//
|
||||
app = ssp->lookup_app(wu_result.workunit.appid);
|
||||
if (app == NULL) continue; // this should never happen
|
||||
if (reply.wreq.beta_only) {
|
||||
if (g_wreq->beta_only) {
|
||||
if (!app->beta) {
|
||||
continue;
|
||||
}
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] beta work found. [RESULT#%d]\n",
|
||||
reply.host.id, wu_result.resultid
|
||||
g_reply->host.id, wu_result.resultid
|
||||
);
|
||||
} else {
|
||||
if (app->beta) {
|
||||
|
@ -90,9 +90,9 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
// skip if the app is beta (beta apps don't use the reliable mechanism)
|
||||
//
|
||||
if (!app->beta) {
|
||||
if (reply.wreq.reliable_only && (!wu_result.need_reliable)) {
|
||||
if (g_wreq->reliable_only && (!wu_result.need_reliable)) {
|
||||
continue;
|
||||
} else if (!reply.wreq.reliable_only && wu_result.need_reliable) {
|
||||
} else if (!g_wreq->reliable_only && wu_result.need_reliable) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
// don't send if we are looking for infeasible results
|
||||
// and the result is not infeasible
|
||||
//
|
||||
if (reply.wreq.infeasible_only && (wu_result.infeasible_count==0)) {
|
||||
if (g_wreq->infeasible_only && (wu_result.infeasible_count==0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -108,15 +108,15 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
|
||||
// check app filter if needed
|
||||
//
|
||||
if (reply.wreq.user_apps_only &&
|
||||
(!reply.wreq.beta_only || config.distinct_beta_apps)
|
||||
if (g_wreq->user_apps_only &&
|
||||
(!g_wreq->beta_only || config.distinct_beta_apps)
|
||||
) {
|
||||
if (app_not_selected(wu)) {
|
||||
reply.wreq.no_allowed_apps_available = true;
|
||||
g_wreq->no_allowed_apps_available = true;
|
||||
if (config.debug_send) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[USER#%d] [WU#%d] user doesn't want work for this application\n",
|
||||
reply.user.id, wu.id
|
||||
g_reply->user.id, wu.id
|
||||
);
|
||||
}
|
||||
continue;
|
||||
|
@ -138,7 +138,7 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (retval != last_retval && config.debug_send) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] [WU#%d %s] WU is infeasible: %s\n",
|
||||
reply.host.id, wu.id, wu.name, infeasible_string(retval)
|
||||
g_reply->host.id, wu.id, wu.name, infeasible_string(retval)
|
||||
);
|
||||
}
|
||||
last_retval = retval;
|
||||
|
@ -162,7 +162,7 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (config.one_result_per_user_per_wu) {
|
||||
sprintf(buf,
|
||||
"where workunitid=%d and userid=%d",
|
||||
wu_result.workunit.id, reply.user.id
|
||||
wu_result.workunit.id, g_reply->user.id
|
||||
);
|
||||
retval = result.count(n, buf);
|
||||
if (retval) {
|
||||
|
@ -174,7 +174,7 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (n>0) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"send_work: user %d already has %d result(s) for WU %d\n",
|
||||
reply.user.id, n, wu_result.workunit.id
|
||||
g_reply->user.id, n, wu_result.workunit.id
|
||||
);
|
||||
goto dont_send;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
//
|
||||
sprintf(buf,
|
||||
"where workunitid=%d and hostid=%d",
|
||||
wu_result.workunit.id, reply.host.id
|
||||
wu_result.workunit.id, g_reply->host.id
|
||||
);
|
||||
retval = result.count(n, buf);
|
||||
if (retval) {
|
||||
|
@ -199,7 +199,7 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (n>0) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"send_work: host %d already has %d result(s) for WU %d\n",
|
||||
reply.host.id, n, wu_result.workunit.id
|
||||
g_reply->host.id, n, wu_result.workunit.id
|
||||
);
|
||||
goto dont_send;
|
||||
}
|
||||
|
@ -208,11 +208,11 @@ void scan_work_array(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
|
||||
if (app_hr_type(*app)) {
|
||||
if (already_sent_to_different_platform_careful(
|
||||
sreq, reply.wreq, wu_result.workunit, *app
|
||||
wu_result.workunit, *app
|
||||
)) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] [WU#%d %s] WU is infeasible (assigned to different platform)\n",
|
||||
reply.host.id, wu.id, wu.name
|
||||
g_reply->host.id, wu.id, wu.name
|
||||
);
|
||||
// Mark the workunit as infeasible.
|
||||
// This ensures that jobs already assigned to a platform
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern void scan_work_array(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
|
||||
extern void scan_work_array();
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
|
||||
#include "sched_assign.h"
|
||||
|
||||
static int send_assigned_job(
|
||||
ASSIGNMENT& asg, SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply
|
||||
) {
|
||||
static int send_assigned_job(ASSIGNMENT& asg) {
|
||||
int retval;
|
||||
DB_WORKUNIT wu;
|
||||
char rtfpath[256], suffix[256], path[256], buf[256];
|
||||
|
@ -99,7 +97,7 @@ static int send_assigned_job(
|
|||
if (config.debug_assignment) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[WU#%d] [RESULT#%d] [HOST#%d] send assignment %d\n",
|
||||
wu.id, result_id, reply.host.id, asg.id
|
||||
wu.id, result_id, g_reply->host.id, asg.id
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
|
@ -108,7 +106,7 @@ static int send_assigned_job(
|
|||
// Send this host any jobs assigned to it, or to its user/team
|
||||
// Return true iff we sent anything
|
||||
//
|
||||
bool send_assigned_jobs(SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply) {
|
||||
bool send_assigned_jobs() {
|
||||
DB_RESULT result;
|
||||
int retval;
|
||||
char buf[256];
|
||||
|
@ -128,46 +126,46 @@ bool send_assigned_jobs(SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply) {
|
|||
switch (asg.target_type) {
|
||||
case ASSIGN_NONE:
|
||||
sprintf(buf, "where hostid=%d and workunitid=%d",
|
||||
reply.host.id, asg.workunitid
|
||||
g_reply->host.id, asg.workunitid
|
||||
);
|
||||
retval = result.lookup(buf);
|
||||
if (retval == ERR_DB_NOT_FOUND) {
|
||||
retval = send_assigned_job(asg, request, reply);
|
||||
retval = send_assigned_job(asg);
|
||||
if (!retval) sent_something = true;
|
||||
}
|
||||
break;
|
||||
case ASSIGN_HOST:
|
||||
if (reply.host.id != asg.target_id) continue;
|
||||
if (g_reply->host.id != asg.target_id) continue;
|
||||
sprintf(buf, "where workunitid=%d", asg.workunitid);
|
||||
retval = result.lookup(buf);
|
||||
if (retval == ERR_DB_NOT_FOUND) {
|
||||
retval = send_assigned_job(asg, request, reply);
|
||||
retval = send_assigned_job(asg);
|
||||
if (!retval) sent_something = true;
|
||||
}
|
||||
break;
|
||||
case ASSIGN_USER:
|
||||
if (reply.user.id != asg.target_id) continue;
|
||||
if (g_reply->user.id != asg.target_id) continue;
|
||||
if (asg.multi) {
|
||||
sprintf(buf, "where workunitid=%d and hostid=%d", asg.workunitid, reply.host.id);
|
||||
sprintf(buf, "where workunitid=%d and hostid=%d", asg.workunitid, g_reply->host.id);
|
||||
} else {
|
||||
sprintf(buf, "where workunitid=%d", asg.workunitid);
|
||||
}
|
||||
retval = result.lookup(buf);
|
||||
if (retval == ERR_DB_NOT_FOUND) {
|
||||
retval = send_assigned_job(asg, request, reply);
|
||||
retval = send_assigned_job(asg);
|
||||
if (!retval) sent_something = true;
|
||||
}
|
||||
break;
|
||||
case ASSIGN_TEAM:
|
||||
if (reply.team.id != asg.target_id) continue;
|
||||
if (g_reply->team.id != asg.target_id) continue;
|
||||
if (asg.multi) {
|
||||
sprintf(buf, "where workunitid=%d and hostid=%d", asg.workunitid, reply.host.id);
|
||||
sprintf(buf, "where workunitid=%d and hostid=%d", asg.workunitid, g_reply->host.id);
|
||||
} else {
|
||||
sprintf(buf, "where workunitid=%d", asg.workunitid);
|
||||
}
|
||||
retval = result.lookup(buf);
|
||||
if (retval == ERR_DB_NOT_FOUND) {
|
||||
retval = send_assigned_job(asg, request, reply);
|
||||
retval = send_assigned_job(asg);
|
||||
if (!retval) sent_something = true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern bool send_assigned_jobs(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
|
||||
extern bool send_assigned_jobs();
|
||||
|
|
|
@ -50,10 +50,8 @@ bool hr_unknown_platform(HOST& host) {
|
|||
|
||||
// quick check for platform compatibility
|
||||
//
|
||||
bool already_sent_to_different_platform_quick(
|
||||
SCHEDULER_REQUEST& sreq, WORKUNIT& wu, APP& app
|
||||
) {
|
||||
if (wu.hr_class && (hr_class(sreq.host, app_hr_type(app)) != wu.hr_class)) {
|
||||
bool already_sent_to_different_platform_quick(WORKUNIT& wu, APP& app) {
|
||||
if (wu.hr_class && (hr_class(g_request->host, app_hr_type(app)) != wu.hr_class)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -69,9 +67,7 @@ bool already_sent_to_different_platform_quick(
|
|||
//
|
||||
// This is "careful" in that it rereads the WU from DB
|
||||
//
|
||||
bool already_sent_to_different_platform_careful(
|
||||
SCHEDULER_REQUEST& sreq, WORK_REQ& wreq, WORKUNIT& workunit, APP& app
|
||||
) {
|
||||
bool already_sent_to_different_platform_careful(WORKUNIT& workunit, APP& app) {
|
||||
DB_WORKUNIT db_wu;
|
||||
int retval, wu_hr_class;
|
||||
char buf[256], buf2[256];
|
||||
|
@ -87,11 +83,11 @@ bool already_sent_to_different_platform_careful(
|
|||
);
|
||||
return true;
|
||||
}
|
||||
wreq.hr_reject_temp = false;
|
||||
int host_hr_class = hr_class(sreq.host, app_hr_type(app));
|
||||
g_wreq->hr_reject_temp = false;
|
||||
int host_hr_class = hr_class(g_request->host, app_hr_type(app));
|
||||
if (wu_hr_class) {
|
||||
if (host_hr_class != wu_hr_class) {
|
||||
wreq.hr_reject_temp = true;
|
||||
g_wreq->hr_reject_temp = true;
|
||||
}
|
||||
} else {
|
||||
// do a "careful update" to make sure the WU's hr_class hasn't
|
||||
|
@ -103,7 +99,7 @@ bool already_sent_to_different_platform_careful(
|
|||
if (retval) return true;
|
||||
if (boinc_db.affected_rows() != 1) return true;
|
||||
}
|
||||
return wreq.hr_reject_temp;
|
||||
return g_wreq->hr_reject_temp;
|
||||
}
|
||||
|
||||
const char *BOINC_RCSID_4196d9a5b4="$Id$";
|
||||
|
|
|
@ -15,12 +15,10 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern bool already_sent_to_different_platform_quick(
|
||||
SCHEDULER_REQUEST& sreq, WORKUNIT&, APP&
|
||||
);
|
||||
extern bool already_sent_to_different_platform_quick(WORKUNIT&, APP&);
|
||||
|
||||
extern bool already_sent_to_different_platform_careful(
|
||||
SCHEDULER_REQUEST& sreq, WORK_REQ& wreq, WORKUNIT& workunit, APP&
|
||||
WORKUNIT& workunit, APP&
|
||||
);
|
||||
|
||||
extern bool hr_unknown_platform(HOST&);
|
||||
|
|
|
@ -49,26 +49,26 @@ using namespace std;
|
|||
|
||||
// returns zero if there is a file we can delete.
|
||||
//
|
||||
int delete_file_from_host(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& sreply) {
|
||||
int delete_file_from_host() {
|
||||
|
||||
#ifdef EINSTEIN_AT_HOME
|
||||
// append the list of deletion candidates to the file list
|
||||
int ndelete_candidates = (int)sreq.file_delete_candidates.size();
|
||||
int ndelete_candidates = (int)g_request->file_delete_candidates.size();
|
||||
for (int j=0; j<ndelete_candidates; j++) {
|
||||
FILE_INFO& fi = sreq.file_delete_candidates[j];
|
||||
sreq.file_infos.push_back(fi);
|
||||
FILE_INFO& fi = g_request->file_delete_candidates[j];
|
||||
g_request->file_infos.push_back(fi);
|
||||
}
|
||||
sreq.file_delete_candidates.clear();
|
||||
g_request->file_delete_candidates.clear();
|
||||
#endif
|
||||
|
||||
int nfiles = (int)sreq.file_infos.size();
|
||||
int nfiles = (int)g_request->file_infos.size();
|
||||
char buf[256];
|
||||
if (!nfiles) {
|
||||
|
||||
double maxdisk=max_allowable_disk();
|
||||
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d]: no disk space but no files we can delete!\n", sreply.host.id
|
||||
"[HOST#%d]: no disk space but no files we can delete!\n", g_reply->host.id
|
||||
);
|
||||
|
||||
if (maxdisk > 0) {
|
||||
|
@ -83,16 +83,16 @@ int delete_file_from_host(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& sreply) {
|
|||
);
|
||||
}
|
||||
|
||||
if (sreply.disk_limits.max_used != 0.0) {
|
||||
if (g_reply->disk_limits.max_used != 0.0) {
|
||||
strcat(buf, "Review preferences for maximum disk space used.");
|
||||
} else if (sreply.disk_limits.max_frac != 0.0) {
|
||||
} else if (g_reply->disk_limits.max_frac != 0.0) {
|
||||
strcat(buf, "Review preferences for maximum disk percentage used.");
|
||||
} else if (sreply.disk_limits.min_free != 0.0) {
|
||||
} else if (g_reply->disk_limits.min_free != 0.0) {
|
||||
strcat(buf, "Review preferences for minimum disk free space allowed.");
|
||||
}
|
||||
USER_MESSAGE um(buf, "high");
|
||||
sreply.insert_message(um);
|
||||
sreply.set_delay(DELAY_DISK_SPACE);
|
||||
g_reply->insert_message(um);
|
||||
g_reply->set_delay(DELAY_DISK_SPACE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -106,11 +106,11 @@ int delete_file_from_host(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& sreply) {
|
|||
// the order in which it reports files is fixed.
|
||||
// If this is false, we need to sort files into order by name!
|
||||
//
|
||||
int j = sreply.host.id % nfiles;
|
||||
FILE_INFO& fi = sreq.file_infos[j];
|
||||
sreply.file_deletes.push_back(fi);
|
||||
int j = g_reply->host.id % nfiles;
|
||||
FILE_INFO& fi = g_request->file_infos[j];
|
||||
g_reply->file_deletes.push_back(fi);
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d]: delete file %s (make space)\n", sreply.host.id, fi.name
|
||||
"[HOST#%d]: delete file %s (make space)\n", g_reply->host.id, fi.name
|
||||
);
|
||||
|
||||
// give host 4 hours to nuke the file and come back.
|
||||
|
@ -119,28 +119,23 @@ int delete_file_from_host(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& sreply) {
|
|||
//
|
||||
sprintf(buf, "BOINC will delete file %s when no longer needed", fi.name);
|
||||
USER_MESSAGE um(buf, "low");
|
||||
sreply.insert_message(um);
|
||||
sreply.set_delay(DELAY_DELETE_FILE);
|
||||
g_reply->insert_message(um);
|
||||
g_reply->set_delay(DELAY_DELETE_FILE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// returns true if the host already has the file, or if the file is
|
||||
// included with a previous result being sent to this host.
|
||||
//
|
||||
bool host_has_file(
|
||||
SCHEDULER_REQUEST& request,
|
||||
SCHEDULER_REPLY& reply,
|
||||
char *filename,
|
||||
bool skip_last_wu
|
||||
) {
|
||||
bool host_has_file(char *filename, bool skip_last_wu) {
|
||||
int i, uplim;
|
||||
bool has_file=false;
|
||||
|
||||
// loop over files already on host to see if host already has the
|
||||
// file
|
||||
//
|
||||
for (i=0; i<(int)request.file_infos.size(); i++) {
|
||||
FILE_INFO& fi = request.file_infos[i];
|
||||
for (i=0; i<(int)g_request->file_infos.size(); i++) {
|
||||
FILE_INFO& fi = g_request->file_infos[i];
|
||||
if (!strcmp(filename, fi.name)) {
|
||||
has_file=true;
|
||||
break;
|
||||
|
@ -149,7 +144,7 @@ bool host_has_file(
|
|||
|
||||
if (has_file) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] Already has file %s\n", reply.host.id, filename
|
||||
"[HOST#%d] Already has file %s\n", g_reply->host.id, filename
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -157,7 +152,7 @@ bool host_has_file(
|
|||
// loop over files being sent to host to see if this file has
|
||||
// already been counted.
|
||||
//
|
||||
uplim=(int)reply.wus.size();
|
||||
uplim=(int)g_reply->wus.size();
|
||||
if (skip_last_wu) {
|
||||
uplim--;
|
||||
}
|
||||
|
@ -165,7 +160,7 @@ bool host_has_file(
|
|||
for (i=0; i<uplim; i++) {
|
||||
char wu_filename[256];
|
||||
|
||||
if (extract_filename(reply.wus[i].name, wu_filename)) {
|
||||
if (extract_filename(g_reply->wus[i].name, wu_filename)) {
|
||||
// work unit does not appear to contain a file name
|
||||
continue;
|
||||
}
|
||||
|
@ -179,7 +174,7 @@ bool host_has_file(
|
|||
|
||||
if (has_file) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] file %s already in scheduler reply(%d)\n", reply.host.id, filename, i
|
||||
"[HOST#%d] file %s already in scheduler reply(%d)\n", g_reply->host.id, filename, i
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -200,10 +195,7 @@ bool host_has_file(
|
|||
// space in the work request should be adjusted by the calling
|
||||
// routine, in the same way as if there was no scheduling locality.
|
||||
//
|
||||
int decrement_disk_space_locality(
|
||||
WORKUNIT& wu, SCHEDULER_REQUEST& request,
|
||||
SCHEDULER_REPLY& reply
|
||||
) {
|
||||
int decrement_disk_space_locality( WORKUNIT& wu) {
|
||||
char filename[256], path[512];
|
||||
int filesize;
|
||||
struct stat buf;
|
||||
|
@ -223,7 +215,7 @@ int decrement_disk_space_locality(
|
|||
// corresponds to the one that we are (possibly) going to send!
|
||||
// So make a copy and pop the current WU off the end.
|
||||
|
||||
if (!host_has_file(request, reply, filename, true))
|
||||
if (!host_has_file(filename, true))
|
||||
return 1;
|
||||
|
||||
// If we are here, then the host ALREADY has the file, or its size
|
||||
|
@ -245,10 +237,10 @@ int decrement_disk_space_locality(
|
|||
filesize=buf.st_size;
|
||||
|
||||
if (filesize<wu.rsc_disk_bound) {
|
||||
reply.wreq.disk_available -= (wu.rsc_disk_bound-filesize);
|
||||
g_wreq->disk_available -= (wu.rsc_disk_bound-filesize);
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] reducing disk needed for WU by %d bytes (length of %s)\n",
|
||||
reply.host.id, filesize, filename
|
||||
g_reply->host.id, filesize, filename
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
@ -266,10 +258,7 @@ int decrement_disk_space_locality(
|
|||
// - already sent a result for this WU
|
||||
// - no app_version available
|
||||
//
|
||||
static int possibly_send_result(
|
||||
DB_RESULT& result,
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply
|
||||
) {
|
||||
static int possibly_send_result(DB_RESULT& result) {
|
||||
DB_WORKUNIT wu;
|
||||
DB_RESULT result2;
|
||||
int retval, count;
|
||||
|
@ -281,15 +270,15 @@ static int possibly_send_result(
|
|||
|
||||
bavp = get_app_version(wu);
|
||||
|
||||
if (!bavp && anonymous(sreq.platforms.list[0])) {
|
||||
if (!bavp && anonymous(g_request->platforms.list[0])) {
|
||||
char help_msg_buf[512];
|
||||
sprintf(help_msg_buf,
|
||||
"To get more %s work, finish current work, stop BOINC, remove app_info.xml file, and restart.",
|
||||
config.long_name
|
||||
);
|
||||
USER_MESSAGE um(help_msg_buf, "high");
|
||||
reply.insert_message(um);
|
||||
reply.set_delay(DELAY_ANONYMOUS);
|
||||
g_reply->insert_message(um);
|
||||
g_reply->set_delay(DELAY_ANONYMOUS);
|
||||
}
|
||||
|
||||
if (!bavp) return ERR_NO_APP_VERSION;
|
||||
|
@ -300,7 +289,7 @@ static int possibly_send_result(
|
|||
}
|
||||
|
||||
if (config.one_result_per_user_per_wu) {
|
||||
sprintf(buf, "where userid=%d and workunitid=%d", reply.user.id, wu.id);
|
||||
sprintf(buf, "where userid=%d and workunitid=%d", g_reply->user.id, wu.id);
|
||||
retval = result2.count(count, buf);
|
||||
if (retval) return ERR_DB_NOT_FOUND;
|
||||
if (count > 0) return ERR_WU_USER_RULE;
|
||||
|
@ -479,7 +468,6 @@ static void flag_for_possible_removal(char* filename) {
|
|||
static int send_results_for_file(
|
||||
char* filename,
|
||||
int& nsent,
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply,
|
||||
bool /*in_working_set*/
|
||||
) {
|
||||
DB_RESULT result, prev_result;
|
||||
|
@ -488,7 +476,7 @@ static int send_results_for_file(
|
|||
|
||||
nsent = 0;
|
||||
|
||||
if (!work_needed(sreq, reply, true)) {
|
||||
if (!work_needed(true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -501,11 +489,11 @@ static int send_results_for_file(
|
|||
sprintf(pattern, "%s__", filename);
|
||||
escape_mysql_like_pattern(pattern, escaped_pattern);
|
||||
sprintf(buf, "where userid=%d and name like binary '%s%%'",
|
||||
reply.user.id, escaped_pattern
|
||||
g_reply->user.id, escaped_pattern
|
||||
);
|
||||
#else
|
||||
sprintf(buf, "where userid=%d and name>binary '%s__' and name<binary '%s__~'",
|
||||
reply.user.id, filename, filename
|
||||
g_reply->user.id, filename, filename
|
||||
);
|
||||
#endif
|
||||
retval_max = result.max_id(maxid, buf);
|
||||
|
@ -519,7 +507,7 @@ static int send_results_for_file(
|
|||
for (i=0; i<100; i++) { // avoid infinite loop
|
||||
int query_retval;
|
||||
|
||||
if (!work_needed(sreq, reply, true)) break;
|
||||
if (!work_needed(true)) break;
|
||||
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"in_send_results_for_file(%s, %d) prev_result.id=%d\n", filename, i, prev_result.id
|
||||
|
@ -633,7 +621,7 @@ static int send_results_for_file(
|
|||
// we found an unsent result, so try sending it.
|
||||
// This *should* always work.
|
||||
//
|
||||
retval_send = possibly_send_result(result, sreq, reply);
|
||||
retval_send = possibly_send_result(result);
|
||||
boinc_db.commit_transaction();
|
||||
|
||||
// if no app version or not enough resources, give up completely
|
||||
|
@ -696,7 +684,6 @@ static int send_results_for_file(
|
|||
// min_resultname = R.filename;
|
||||
//
|
||||
static int send_new_file_work_deterministic_seeded(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply,
|
||||
int& nsent, const char *start_f, const char *end_f
|
||||
) {
|
||||
DB_RESULT result;
|
||||
|
@ -736,11 +723,11 @@ static int send_new_file_work_deterministic_seeded(
|
|||
"send_new_file_work_deterministic will try filename %s\n", filename
|
||||
);
|
||||
|
||||
retval = send_results_for_file(filename, nsent, sreq, reply, false);
|
||||
retval = send_results_for_file(filename, nsent, false);
|
||||
|
||||
if (retval==ERR_NO_APP_VERSION || retval==ERR_INSUFFICIENT_RESOURCE) return retval;
|
||||
|
||||
if (nsent>0 || !work_needed(sreq, reply, true)) break;
|
||||
if (nsent>0 || !work_needed(true)) break;
|
||||
// construct a name which is lexically greater than the name of any result
|
||||
// which uses this file.
|
||||
sprintf(min_resultname, "%s__~", filename);
|
||||
|
@ -749,14 +736,14 @@ static int send_new_file_work_deterministic_seeded(
|
|||
}
|
||||
|
||||
|
||||
static bool is_host_slow(SCHEDULER_REQUEST& sreq) {
|
||||
static bool is_host_slow() {
|
||||
// 0.0013 defines about the slowest 20% of E@H hosts.
|
||||
// should make this a config parameter in the future,
|
||||
// if this idea works.
|
||||
//
|
||||
|
||||
static int speed_not_printed = 1;
|
||||
double hostspeed = sreq.host.claimed_credit_per_cpu_sec;
|
||||
double hostspeed = g_request->host.claimed_credit_per_cpu_sec;
|
||||
|
||||
if (speed_not_printed) {
|
||||
speed_not_printed = 0;
|
||||
|
@ -771,31 +758,29 @@ static bool is_host_slow(SCHEDULER_REQUEST& sreq) {
|
|||
// 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
|
||||
) {
|
||||
static int send_new_file_work_deterministic() {
|
||||
char start_filename[256];
|
||||
int getfile_retval, nsent=0;
|
||||
|
||||
// get random filename as starting point for deterministic search
|
||||
// If at this point, we have probably failed to find a suitable file
|
||||
// for a slow host, so ignore speed of host.
|
||||
if ((getfile_retval = get_working_set_filename(start_filename, /* is_host_slow(sreq) */ false))) {
|
||||
if ((getfile_retval = get_working_set_filename(start_filename, /* is_host_slow() */ false))) {
|
||||
strcpy(start_filename, "");
|
||||
}
|
||||
|
||||
// start deterministic search with randomly chosen filename, go to
|
||||
// lexical maximum
|
||||
send_new_file_work_deterministic_seeded(sreq, reply, nsent, start_filename, NULL);
|
||||
send_new_file_work_deterministic_seeded(nsent, start_filename, NULL);
|
||||
if (nsent) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// continue deterministic search at lexically first possible
|
||||
// filename, continue to randomly choosen one
|
||||
if (!getfile_retval && work_needed(sreq, reply, true)) {
|
||||
if (!getfile_retval && work_needed(true)) {
|
||||
send_new_file_work_deterministic_seeded(
|
||||
sreq, reply, nsent, "", start_filename
|
||||
nsent, "", start_filename
|
||||
);
|
||||
if (nsent) {
|
||||
return 0;
|
||||
|
@ -806,35 +791,29 @@ static int send_new_file_work_deterministic(
|
|||
}
|
||||
|
||||
|
||||
static int send_new_file_work_working_set(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply
|
||||
) {
|
||||
static int send_new_file_work_working_set() {
|
||||
char filename[256];
|
||||
int retval, nsent;
|
||||
|
||||
retval = get_working_set_filename(filename, is_host_slow(sreq));
|
||||
retval = get_working_set_filename(filename, is_host_slow());
|
||||
if (retval) return retval;
|
||||
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"send_new_file_working_set will try filename %s\n", filename
|
||||
);
|
||||
|
||||
return send_results_for_file(filename, nsent, sreq, reply, true);
|
||||
return send_results_for_file(filename, nsent, true);
|
||||
}
|
||||
|
||||
// prototype
|
||||
static int send_old_work(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, int t_min, int t_max
|
||||
);
|
||||
static int send_old_work(int t_min, int t_max);
|
||||
|
||||
// The host doesn't have any files for which work is available.
|
||||
// Pick new file to send. Returns nonzero if no work is available.
|
||||
//
|
||||
static int send_new_file_work(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply
|
||||
) {
|
||||
static int send_new_file_work() {
|
||||
|
||||
while (work_needed(sreq, reply, true)) {
|
||||
while (work_needed(true)) {
|
||||
int retval_sow, retval_snfwws;
|
||||
double frac=((double)rand())/(double)RAND_MAX;
|
||||
int now = time(0);
|
||||
|
@ -852,33 +831,33 @@ static int send_new_file_work(
|
|||
"send_new_file_work(): try to send old work\n"
|
||||
);
|
||||
|
||||
retval_sow=send_old_work(sreq, reply, start, end);
|
||||
retval_sow=send_old_work(start, end);
|
||||
|
||||
if (retval_sow==ERR_NO_APP_VERSION || retval_sow==ERR_INSUFFICIENT_RESOURCE) return retval_sow;
|
||||
|
||||
|
||||
while (work_needed(sreq, reply, true) && retry<5) {
|
||||
while (work_needed(true) && retry<5) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"send_new_file_work(%d): try to send from working set\n", retry
|
||||
);
|
||||
retry++;
|
||||
retval_snfwws=send_new_file_work_working_set(sreq, reply);
|
||||
retval_snfwws=send_new_file_work_working_set();
|
||||
if (retval_snfwws==ERR_NO_APP_VERSION || retval_snfwws==ERR_INSUFFICIENT_RESOURCE) return retval_snfwws;
|
||||
|
||||
}
|
||||
|
||||
if (work_needed(sreq, reply, true)) {
|
||||
if (work_needed(true)) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"send_new_file_work(): try deterministic method\n"
|
||||
);
|
||||
if (send_new_file_work_deterministic(sreq, reply)) {
|
||||
if (send_new_file_work_deterministic()) {
|
||||
// if no work remains at all,
|
||||
// we learn it here and return nonzero.
|
||||
//
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} // while reply.work_needed(sreq, reply, true)
|
||||
} // while g_reply->work_needed(true)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -890,15 +869,13 @@ static int send_new_file_work(
|
|||
// This looks for work created in the range t_min < t < t_max. Use
|
||||
// t_min=INT_MIN if you wish to leave off the left constraint.
|
||||
//
|
||||
static int send_old_work(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, int t_min, int t_max
|
||||
) {
|
||||
static int send_old_work(int t_min, int t_max) {
|
||||
char buf[1024], filename[256];
|
||||
int retval, extract_retval, nsent;
|
||||
DB_RESULT result;
|
||||
int now=time(0);
|
||||
|
||||
if (!work_needed(sreq, reply, true)) {
|
||||
if (!work_needed(true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -918,7 +895,7 @@ static int send_old_work(
|
|||
|
||||
retval = result.lookup(buf);
|
||||
if (!retval) {
|
||||
retval = possibly_send_result(result, sreq, reply);
|
||||
retval = possibly_send_result(result);
|
||||
boinc_db.commit_transaction();
|
||||
if (!retval) {
|
||||
double age=(now-result.create_time)/3600.0;
|
||||
|
@ -927,7 +904,7 @@ static int send_old_work(
|
|||
);
|
||||
extract_retval=extract_filename(result.name, filename);
|
||||
if (!extract_retval) {
|
||||
send_results_for_file(filename, nsent, sreq, reply, false);
|
||||
send_results_for_file(filename, nsent, false);
|
||||
} else {
|
||||
// David, is this right? Is this the only place in
|
||||
// the locality scheduler that non-locality work //
|
||||
|
@ -973,9 +950,7 @@ bool file_info_order(const FILE_INFO& fi1, const FILE_INFO& fi2) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void send_work_locality(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply
|
||||
) {
|
||||
void send_work_locality() {
|
||||
int i, nsent, nfiles, j;
|
||||
|
||||
// seed the random number generator
|
||||
|
@ -983,9 +958,9 @@ void send_work_locality(
|
|||
srand(seed);
|
||||
|
||||
#ifdef EINSTEIN_AT_HOME
|
||||
std::vector<FILE_INFO> eah_copy = sreq.file_infos;
|
||||
sreq.file_infos.clear();
|
||||
sreq.files_not_needed.clear();
|
||||
std::vector<FILE_INFO> eah_copy = g_request->file_infos;
|
||||
g_request->file_infos.clear();
|
||||
g_request->files_not_needed.clear();
|
||||
nfiles = (int) eah_copy.size();
|
||||
for (i=0; i<nfiles; i++) {
|
||||
char *fname = eah_copy[i].name;
|
||||
|
@ -1014,37 +989,37 @@ void send_work_locality(
|
|||
if (!useful) {
|
||||
// these files WILL be deleted from the host
|
||||
//
|
||||
sreq.files_not_needed.push_back(eah_copy[i]);
|
||||
g_request->files_not_needed.push_back(eah_copy[i]);
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] adding file %s to files_not_needed list\n", reply.host.id, fname
|
||||
"[HOST#%d] adding file %s to files_not_needed list\n", g_reply->host.id, fname
|
||||
);
|
||||
} else if (!data_files) {
|
||||
// these files MIGHT be deleted from host if we need to make
|
||||
// disk space there
|
||||
//
|
||||
sreq.file_delete_candidates.push_back(eah_copy[i]);
|
||||
g_request->file_delete_candidates.push_back(eah_copy[i]);
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] removing file %s from file_infos list\n", reply.host.id, fname
|
||||
"[HOST#%d] removing file %s from file_infos list\n", g_reply->host.id, fname
|
||||
);
|
||||
} else {
|
||||
// these are files that we will use for locality scheduling and
|
||||
// to search for work
|
||||
//
|
||||
sreq.file_infos.push_back(eah_copy[i]);
|
||||
g_request->file_infos.push_back(eah_copy[i]);
|
||||
}
|
||||
}
|
||||
#endif // EINSTEIN_AT_HOME
|
||||
|
||||
nfiles = (int) sreq.file_infos.size();
|
||||
nfiles = (int) g_request->file_infos.size();
|
||||
for (i=0; i<nfiles; i++)
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] has file %s\n", reply.host.id, sreq.file_infos[i].name
|
||||
"[HOST#%d] has file %s\n", g_reply->host.id, g_request->file_infos[i].name
|
||||
);
|
||||
|
||||
// Look for work in order of increasing file name, or randomly?
|
||||
//
|
||||
if (config.locality_scheduling_sorted_order) {
|
||||
sort(sreq.file_infos.begin(), sreq.file_infos.end(), file_info_order);
|
||||
sort(g_request->file_infos.begin(), g_request->file_infos.end(), file_info_order);
|
||||
j = 0;
|
||||
} else {
|
||||
if (!nfiles) nfiles = 1;
|
||||
|
@ -1055,22 +1030,22 @@ void send_work_locality(
|
|||
// high-bandwidth connections, since asking dial-up users to upload
|
||||
// (presumably large) data files is onerous.
|
||||
//
|
||||
if (config.locality_scheduling_send_timeout && sreq.host.n_bwdown>100000) {
|
||||
if (config.locality_scheduling_send_timeout && g_request->host.n_bwdown>100000) {
|
||||
int until=time(0)-config.locality_scheduling_send_timeout;
|
||||
int retval_sow=send_old_work(sreq, reply, INT_MIN, until);
|
||||
int retval_sow=send_old_work(INT_MIN, until);
|
||||
if (retval_sow==ERR_NO_APP_VERSION || retval_sow==ERR_INSUFFICIENT_RESOURCE) return;
|
||||
}
|
||||
|
||||
// send work for existing files
|
||||
//
|
||||
for (i=0; i<(int)sreq.file_infos.size(); i++) {
|
||||
for (i=0; i<(int)g_request->file_infos.size(); i++) {
|
||||
int k = (i+j)%nfiles;
|
||||
int retval_srff;
|
||||
|
||||
if (!work_needed(sreq, reply, true)) break;
|
||||
FILE_INFO& fi = sreq.file_infos[k];
|
||||
if (!work_needed(true)) break;
|
||||
FILE_INFO& fi = g_request->file_infos[k];
|
||||
retval_srff=send_results_for_file(
|
||||
fi.name, nsent, sreq, reply, false
|
||||
fi.name, nsent, false
|
||||
);
|
||||
|
||||
if (retval_srff==ERR_NO_APP_VERSION || retval_srff==ERR_INSUFFICIENT_RESOURCE) return;
|
||||
|
@ -1081,10 +1056,10 @@ void send_work_locality(
|
|||
// If the work was not sent for other (dynamic) reason such as insufficient
|
||||
// cpu, then DON'T delete the file.
|
||||
//
|
||||
if (nsent == 0 && work_needed(sreq, reply, true) && config.file_deletion_strategy == 1) {
|
||||
reply.file_deletes.push_back(fi);
|
||||
if (nsent == 0 && work_needed(true) && config.file_deletion_strategy == 1) {
|
||||
g_reply->file_deletes.push_back(fi);
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d]: delete file %s (not needed)\n", reply.host.id, fi.name
|
||||
"[HOST#%d]: delete file %s (not needed)\n", g_reply->host.id, fi.name
|
||||
);
|
||||
#ifdef EINSTEIN_AT_HOME
|
||||
// For name matching pattern h1_XXXX.XX_S5R2
|
||||
|
@ -1093,9 +1068,9 @@ void send_work_locality(
|
|||
if (strlen(fi.name)==15 && !strncmp("h1_", fi.name, 3)) {
|
||||
FILE_INFO fi_l = fi;
|
||||
fi_l.name[0]='l';
|
||||
reply.file_deletes.push_back(fi_l);
|
||||
g_reply->file_deletes.push_back(fi_l);
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d]: delete file %s (not needed)\n", reply.host.id, fi_l.name
|
||||
"[HOST#%d]: delete file %s (not needed)\n", g_reply->host.id, fi_l.name
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
@ -1104,42 +1079,42 @@ void send_work_locality(
|
|||
|
||||
// send new files if needed
|
||||
//
|
||||
if (work_needed(sreq, reply, true)) {
|
||||
send_new_file_work(sreq, reply);
|
||||
if (work_needed(true)) {
|
||||
send_new_file_work();
|
||||
}
|
||||
}
|
||||
|
||||
// send instructions to delete useless files
|
||||
//
|
||||
void send_file_deletes(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& sreply) {
|
||||
int num_useless = sreq.files_not_needed.size();
|
||||
void send_file_deletes() {
|
||||
int num_useless = g_request->files_not_needed.size();
|
||||
int i;
|
||||
for (i=0; i<num_useless; i++) {
|
||||
char buf[256];
|
||||
FILE_INFO& fi = sreq.files_not_needed[i];
|
||||
sreply.file_deletes.push_back(fi);
|
||||
FILE_INFO& fi = g_request->files_not_needed[i];
|
||||
g_reply->file_deletes.push_back(fi);
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d]: delete file %s (not needed)\n", sreply.host.id, fi.name
|
||||
"[HOST#%d]: delete file %s (not needed)\n", g_reply->host.id, fi.name
|
||||
);
|
||||
sprintf(buf, "BOINC will delete file %s (no longer needed)", fi.name);
|
||||
USER_MESSAGE um(buf, "low");
|
||||
sreply.insert_message(um);
|
||||
g_reply->insert_message(um);
|
||||
}
|
||||
|
||||
// if we got no work, and we have no file space, delete some files
|
||||
//
|
||||
if (sreply.results.size()==0 && (sreply.wreq.disk.insufficient || sreply.wreq.disk_available<0)) {
|
||||
if (g_reply->results.size()==0 && (g_reply->wreq.disk.insufficient || g_reply->wreq.disk_available<0)) {
|
||||
// try to delete a file to make more space.
|
||||
// Also give some hints to the user about what's going wrong
|
||||
// (lack of disk space).
|
||||
//
|
||||
delete_file_from_host(sreq, sreply);
|
||||
delete_file_from_host();
|
||||
}
|
||||
|
||||
if (sreply.results.size()==0 && sreply.hostid && sreq.work_req_seconds>1.0) {
|
||||
debug_sched(sreq, sreply, "../debug_sched");
|
||||
} else if (max_allowable_disk()<0 || (sreply.wreq.disk.insufficient || sreply.wreq.disk_available<0)) {
|
||||
debug_sched(sreq, sreply, "../debug_sched");
|
||||
if (g_reply->results.size()==0 && g_reply->hostid && g_request->work_req_seconds>1.0) {
|
||||
debug_sched("../debug_sched");
|
||||
} else if (max_allowable_disk()<0 || (g_reply->wreq.disk.insufficient || g_reply->wreq.disk_available<0)) {
|
||||
debug_sched("../debug_sched");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,10 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern void send_work_locality(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
|
||||
extern void send_work_locality();
|
||||
|
||||
extern int decrement_disk_space_locality(
|
||||
WORKUNIT& wu, SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply
|
||||
);
|
||||
extern int decrement_disk_space_locality(WORKUNIT& wu);
|
||||
|
||||
extern int delete_file_from_host(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
|
||||
extern int delete_file_from_host();
|
||||
|
||||
extern void send_file_deletes(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
|
||||
extern void send_file_deletes();
|
||||
|
|
|
@ -96,7 +96,7 @@ static int possibly_give_result_new_deadline(
|
|||
// 3) aren't present on the host
|
||||
// Return true if there were any such jobs
|
||||
//
|
||||
bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
||||
bool resend_lost_work() {
|
||||
DB_RESULT result;
|
||||
std::vector<DB_RESULT>results;
|
||||
unsigned int i;
|
||||
|
@ -109,12 +109,12 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
int retval;
|
||||
|
||||
sprintf(buf, " where hostid=%d and server_state=%d ",
|
||||
reply.host.id, RESULT_SERVER_STATE_IN_PROGRESS
|
||||
g_reply->host.id, RESULT_SERVER_STATE_IN_PROGRESS
|
||||
);
|
||||
while (!result.enumerate(buf)) {
|
||||
bool found = false;
|
||||
for (i=0; i<sreq.other_results.size(); i++) {
|
||||
OTHER_RESULT& orp = sreq.other_results[i];
|
||||
for (i=0; i<g_request->other_results.size(); i++) {
|
||||
OTHER_RESULT& orp = g_request->other_results[i];
|
||||
if (!strcmp(orp.name.c_str(), result.name)) {
|
||||
found = true;
|
||||
break;
|
||||
|
@ -126,7 +126,7 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (config.debug_resend) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] found lost [RESULT#%d]: %s\n",
|
||||
reply.host.id, result.id, result.name
|
||||
g_reply->host.id, result.id, result.name
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] WU not found for [RESULT#%d]\n",
|
||||
reply.host.id, result.id
|
||||
g_reply->host.id, result.id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (!bavp) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] no app version [RESULT#%d]\n",
|
||||
reply.host.id, result.id
|
||||
g_reply->host.id, result.id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (config.debug_resend) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d][RESULT#%d] not needed or too close to deadline, expiring\n",
|
||||
reply.host.id, result.id
|
||||
g_reply->host.id, result.id
|
||||
);
|
||||
}
|
||||
result.report_deadline = time(0)-1;
|
||||
|
@ -187,19 +187,19 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
"Didn't resend lost result %s (expired)", result.name
|
||||
);
|
||||
USER_MESSAGE um(warning_msg, "high");
|
||||
reply.insert_message(um);
|
||||
g_reply->insert_message(um);
|
||||
} else {
|
||||
retval = add_result_to_reply(result, wu, bavp);
|
||||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] failed to send [RESULT#%d]\n",
|
||||
reply.host.id, result.id
|
||||
g_reply->host.id, result.id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
sprintf(warning_msg, "Resent lost result %s", result.name);
|
||||
USER_MESSAGE um(warning_msg, "high");
|
||||
reply.insert_message(um);
|
||||
g_reply->insert_message(um);
|
||||
num_resent++;
|
||||
did_any = true;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ bool resend_lost_work(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
|
||||
if (num_eligible_to_resend && config.debug_resend) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] %d lost results, resent %d\n", reply.host.id, num_eligible_to_resend, num_resent
|
||||
"[HOST#%d] %d lost results, resent %d\n", g_reply->host.id, num_eligible_to_resend, num_resent
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern bool resend_lost_work(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
|
||||
extern bool resend_lost_work();
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
// handle completed results
|
||||
//
|
||||
int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
||||
int handle_results() {
|
||||
DB_SCHED_RESULT_ITEM_SET result_handler;
|
||||
SCHED_RESULT_ITEM* srip;
|
||||
unsigned int i;
|
||||
|
@ -36,13 +36,13 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
RESULT* rp;
|
||||
bool changed_host=false;
|
||||
|
||||
if (sreq.results.size() == 0) return 0;
|
||||
if (g_request->results.size() == 0) return 0;
|
||||
|
||||
// copy reported results to a separate vector, "result_handler",
|
||||
// initially with only the "name" field present
|
||||
//
|
||||
for (i=0; i<sreq.results.size(); i++) {
|
||||
result_handler.add_result(sreq.results[i].name);
|
||||
for (i=0; i<g_request->results.size(); i++) {
|
||||
result_handler.add_result(g_request->results[i].name);
|
||||
}
|
||||
|
||||
// read results from database into "result_handler".
|
||||
|
@ -59,7 +59,7 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] Batch query failed\n",
|
||||
reply.host.id
|
||||
g_reply->host.id
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -71,24 +71,24 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
// In other words, the only time we don't ack a result is when
|
||||
// it looks OK but the update failed.
|
||||
//
|
||||
for (i=0; i<sreq.results.size(); i++) {
|
||||
rp = &sreq.results[i];
|
||||
for (i=0; i<g_request->results.size(); i++) {
|
||||
rp = &g_request->results[i];
|
||||
|
||||
retval = result_handler.lookup_result(rp->name, &srip);
|
||||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] [RESULT#? %s] can't find result\n",
|
||||
reply.host.id, rp->name
|
||||
g_reply->host.id, rp->name
|
||||
);
|
||||
|
||||
reply.result_acks.push_back(std::string(rp->name));
|
||||
g_reply->result_acks.push_back(std::string(rp->name));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (config.debug_handle_results) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] [RESULT#%d %s] got result (DB: server_state=%d outcome=%d client_state=%d validate_state=%d delete_state=%d)\n",
|
||||
reply.host.id, srip->id, srip->name, srip->server_state,
|
||||
g_reply->host.id, srip->id, srip->name, srip->server_state,
|
||||
srip->outcome, srip->client_state, srip->validate_state,
|
||||
srip->file_delete_state
|
||||
);
|
||||
|
@ -143,14 +143,14 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
char buf[256];
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] [RESULT#%d %s] result already over [outcome=%d validate_state=%d]: %s\n",
|
||||
reply.host.id, srip->id, srip->name, srip->outcome,
|
||||
g_reply->host.id, srip->id, srip->name, srip->outcome,
|
||||
srip->validate_state, dont_replace_result
|
||||
);
|
||||
sprintf(buf, "Completed result %s refused: %s", srip->name, dont_replace_result);
|
||||
USER_MESSAGE um(buf, "high");
|
||||
reply.insert_message(um);
|
||||
g_reply->insert_message(um);
|
||||
srip->id = 0;
|
||||
reply.result_acks.push_back(std::string(rp->name));
|
||||
g_reply->result_acks.push_back(std::string(rp->name));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -158,28 +158,28 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (srip->server_state == RESULT_SERVER_STATE_UNSENT) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] [RESULT#%d %s] got unexpected result: server state is %d\n",
|
||||
reply.host.id, srip->id, srip->name, srip->server_state
|
||||
g_reply->host.id, srip->id, srip->name, srip->server_state
|
||||
);
|
||||
srip->id = 0;
|
||||
reply.result_acks.push_back(std::string(rp->name));
|
||||
g_reply->result_acks.push_back(std::string(rp->name));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (srip->received_time) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] [RESULT#%d %s] already got result, at %s \n",
|
||||
reply.host.id, srip->id, srip->name,
|
||||
g_reply->host.id, srip->id, srip->name,
|
||||
time_to_string(srip->received_time)
|
||||
);
|
||||
srip->id = 0;
|
||||
reply.result_acks.push_back(std::string(rp->name));
|
||||
g_reply->result_acks.push_back(std::string(rp->name));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (srip->hostid != reply.host.id) {
|
||||
if (srip->hostid != g_reply->host.id) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] [RESULT#%d %s] got result from wrong host; expected [HOST#%d]\n",
|
||||
reply.host.id, srip->id, srip->name, srip->hostid
|
||||
g_reply->host.id, srip->id, srip->name, srip->hostid
|
||||
);
|
||||
DB_HOST result_host;
|
||||
retval = result_host.lookup_id(srip->hostid);
|
||||
|
@ -190,20 +190,20 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
srip->id, srip->name, srip->hostid
|
||||
);
|
||||
srip->id = 0;
|
||||
reply.result_acks.push_back(std::string(rp->name));
|
||||
g_reply->result_acks.push_back(std::string(rp->name));
|
||||
continue;
|
||||
} else if (result_host.userid != reply.host.userid) {
|
||||
} else if (result_host.userid != g_reply->host.userid) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[USER#%d] [HOST#%d] [RESULT#%d %s] Not even the same user; expected [USER#%d]\n",
|
||||
reply.host.userid, reply.host.id, srip->id, srip->name, result_host.userid
|
||||
g_reply->host.userid, g_reply->host.id, srip->id, srip->name, result_host.userid
|
||||
);
|
||||
srip->id = 0;
|
||||
reply.result_acks.push_back(std::string(rp->name));
|
||||
g_reply->result_acks.push_back(std::string(rp->name));
|
||||
continue;
|
||||
} else {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] [RESULT#%d %s] Allowing result because same USER#%d\n",
|
||||
reply.host.id, srip->id, srip->name, reply.host.userid
|
||||
g_reply->host.id, srip->id, srip->name, g_reply->host.userid
|
||||
);
|
||||
changed_host = true;
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
// If we found a problem above,
|
||||
// we have continued and skipped this modify
|
||||
//
|
||||
srip->hostid = reply.host.id;
|
||||
srip->teamid = reply.user.teamid;
|
||||
srip->hostid = g_reply->host.id;
|
||||
srip->teamid = g_reply->user.teamid;
|
||||
srip->received_time = time(0);
|
||||
srip->client_state = rp->client_state;
|
||||
srip->cpu_time = rp->cpu_time;
|
||||
|
@ -246,7 +246,7 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
rp->intops_per_cpu_sec*srip->cpu_time
|
||||
);
|
||||
} else {
|
||||
srip->claimed_credit = srip->cpu_time * reply.host.claimed_credit_per_cpu_sec;
|
||||
srip->claimed_credit = srip->cpu_time * g_reply->host.claimed_credit_per_cpu_sec;
|
||||
}
|
||||
|
||||
if (config.use_credit_multiplier) {
|
||||
|
@ -259,7 +259,7 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
|
||||
if (config.debug_handle_results) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"cpu time %f credit/sec %f, claimed credit %f\n", srip->cpu_time, reply.host.claimed_credit_per_cpu_sec, srip->claimed_credit
|
||||
"cpu time %f credit/sec %f, claimed credit %f\n", srip->cpu_time, g_reply->host.claimed_credit_per_cpu_sec, srip->claimed_credit
|
||||
);
|
||||
}
|
||||
srip->server_state = RESULT_SERVER_STATE_OVER;
|
||||
|
@ -281,7 +281,7 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
srip->id, srip->name
|
||||
);
|
||||
}
|
||||
reply.got_good_result();
|
||||
g_reply->got_good_result();
|
||||
} else {
|
||||
if (config.debug_handle_results) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
|
@ -291,7 +291,7 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
}
|
||||
srip->outcome = RESULT_OUTCOME_CLIENT_ERROR;
|
||||
srip->validate_state = VALIDATE_STATE_INVALID;
|
||||
reply.got_bad_result();
|
||||
g_reply->got_bad_result();
|
||||
}
|
||||
} // loop over all incoming results
|
||||
|
||||
|
@ -305,10 +305,10 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] [RESULT#%d %s] can't update result: %s\n",
|
||||
reply.host.id, sri.id, sri.name, boinc_db.error_string()
|
||||
g_reply->host.id, sri.id, sri.name, boinc_db.error_string()
|
||||
);
|
||||
} else {
|
||||
reply.result_acks.push_back(std::string(sri.name));
|
||||
g_reply->result_acks.push_back(std::string(sri.name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"[HOST#%d] can't update WUs: %d\n",
|
||||
reply.host.id, retval
|
||||
g_reply->host.id, retval
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern int handle_results(SCHEDULER_REQUEST&, SCHEDULER_REPLY&);
|
||||
extern int handle_results();
|
||||
|
|
|
@ -633,7 +633,7 @@ int wu_is_infeasible_fast(WORKUNIT& wu, APP& app, BEST_APP_VERSION& bav) {
|
|||
}
|
||||
return INFEASIBLE_HR;
|
||||
}
|
||||
if (already_sent_to_different_platform_quick(*g_request, wu, app)) {
|
||||
if (already_sent_to_different_platform_quick(wu, app)) {
|
||||
if (config.debug_send) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] [WU#%d %s] failed quick HR check: WU is class %d, host is class %d\n",
|
||||
|
@ -645,7 +645,7 @@ int wu_is_infeasible_fast(WORKUNIT& wu, APP& app, BEST_APP_VERSION& bav) {
|
|||
}
|
||||
|
||||
if (config.one_result_per_user_per_wu || config.one_result_per_host_per_wu) {
|
||||
if (wu_already_in_reply(wu, *g_reply)) {
|
||||
if (wu_already_in_reply(wu)) {
|
||||
return INFEASIBLE_DUP;
|
||||
}
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ int add_wu_to_reply(
|
|||
APP_VERSION av2=*avp, *avp2=&av2;
|
||||
|
||||
if (config.choose_download_url_by_timezone) {
|
||||
process_av_timezone(reply, avp, av2);
|
||||
process_av_timezone(avp, av2);
|
||||
}
|
||||
|
||||
g_reply->insert_app_unique(*app);
|
||||
|
@ -775,9 +775,9 @@ int add_wu_to_reply(
|
|||
log_messages.printf(MSG_CRITICAL, "insert_wu_tags failed %d\n", retval);
|
||||
return retval;
|
||||
}
|
||||
wu3=wu2;
|
||||
wu3 = wu2;
|
||||
if (config.choose_download_url_by_timezone) {
|
||||
process_wu_timezone(reply, wu2, wu3);
|
||||
process_wu_timezone(wu2, wu3);
|
||||
}
|
||||
|
||||
g_reply->insert_workunit_unique(wu3);
|
||||
|
@ -825,7 +825,7 @@ int update_wu_transition_time(WORKUNIT wu, time_t x) {
|
|||
|
||||
// return true iff a result for same WU is already being sent
|
||||
//
|
||||
bool wu_already_in_reply(WORKUNIT& wu, SCHEDULER_REPLY& reply) {
|
||||
bool wu_already_in_reply(WORKUNIT& wu) {
|
||||
unsigned int i;
|
||||
for (i=0; i<g_reply->results.size(); i++) {
|
||||
if (wu.id == g_reply->results[i].workunitid) {
|
||||
|
@ -848,9 +848,7 @@ void unlock_sema() {
|
|||
// and we haven't exceeded result per RPC limit,
|
||||
// and we haven't exceeded results per day limit
|
||||
//
|
||||
bool work_needed(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, bool locality_sched
|
||||
) {
|
||||
bool work_needed(bool locality_sched) {
|
||||
if (locality_sched) {
|
||||
// if we've failed to send a result because of a transient condition,
|
||||
// return false to preserve invariant
|
||||
|
@ -922,7 +920,7 @@ int add_result_to_reply(DB_RESULT& result, WORKUNIT& wu, BEST_APP_VERSION* bavp)
|
|||
// IF the host already has the file OR the file was not already sent.
|
||||
//
|
||||
if (!config.locality_scheduling ||
|
||||
decrement_disk_space_locality(wu, *g_request, *g_reply)
|
||||
decrement_disk_space_locality(wu)
|
||||
) {
|
||||
g_wreq->disk_available -= wu.rsc_disk_bound;
|
||||
}
|
||||
|
@ -1294,7 +1292,7 @@ static void send_work_old() {
|
|||
if (g_wreq->reliable) {
|
||||
g_wreq->reliable_only = true;
|
||||
g_wreq->infeasible_only = false;
|
||||
scan_work_array(*g_request, *g_reply);
|
||||
scan_work_array();
|
||||
}
|
||||
g_wreq->reliable_only = false;
|
||||
|
||||
|
@ -1310,17 +1308,17 @@ static void send_work_old() {
|
|||
g_reply->host.id
|
||||
);
|
||||
}
|
||||
scan_work_array(*g_request, *g_reply);
|
||||
scan_work_array();
|
||||
}
|
||||
g_wreq->beta_only = false;
|
||||
|
||||
// give next priority to results that were infeasible for some other host
|
||||
//
|
||||
g_wreq->infeasible_only = true;
|
||||
scan_work_array(*g_request, *g_reply);
|
||||
scan_work_array();
|
||||
|
||||
g_wreq->infeasible_only = false;
|
||||
scan_work_array(*g_request, *g_reply);
|
||||
scan_work_array();
|
||||
|
||||
// If user has selected apps but will accept any,
|
||||
// and we haven't found any jobs for selected apps, try others
|
||||
|
@ -1334,7 +1332,7 @@ static void send_work_old() {
|
|||
g_reply->host.id
|
||||
);
|
||||
}
|
||||
scan_work_array(*g_request, *g_reply);
|
||||
scan_work_array();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1406,7 +1404,7 @@ void send_work() {
|
|||
}
|
||||
|
||||
if (config.enable_assignment) {
|
||||
if (send_assigned_jobs(*g_request, *g_reply)) {
|
||||
if (send_assigned_jobs()) {
|
||||
if (config.debug_assignment) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] sent assigned jobs\n", g_reply->host.id
|
||||
|
@ -1424,7 +1422,7 @@ void send_work() {
|
|||
|
||||
if (config.locality_scheduling) {
|
||||
g_wreq->infeasible_only = false;
|
||||
send_work_locality(*g_request, *g_reply);
|
||||
send_work_locality();
|
||||
} else if (config.matchmaker) {
|
||||
send_work_matchmaker();
|
||||
} else {
|
||||
|
@ -1662,9 +1660,7 @@ bool wu_is_infeasible_slow(
|
|||
APP* app = ssp->lookup_app(wu_result.workunit.appid);
|
||||
WORKUNIT wu = wu_result.workunit;
|
||||
if (app_hr_type(*app)) {
|
||||
if (already_sent_to_different_platform_careful(
|
||||
sreq, *g_wreq, wu, *app
|
||||
)) {
|
||||
if (already_sent_to_different_platform_careful(wu, *app)) {
|
||||
if (config.debug_send) {
|
||||
log_messages.printf(MSG_DEBUG,
|
||||
"[HOST#%d] [WU#%d %s] WU is infeasible (assigned to different platform)\n",
|
||||
|
|
|
@ -47,7 +47,7 @@ extern int wu_is_infeasible_fast(WORKUNIT&, APP&, BEST_APP_VERSION&);
|
|||
|
||||
extern double max_allowable_disk();
|
||||
|
||||
extern bool wu_already_in_reply(WORKUNIT& wu, SCHEDULER_REPLY& reply);
|
||||
extern bool wu_already_in_reply(WORKUNIT& wu);
|
||||
|
||||
extern double estimate_duration(WORKUNIT& wu, BEST_APP_VERSION&);
|
||||
|
||||
|
@ -57,4 +57,4 @@ extern void lock_sema();
|
|||
extern void unlock_sema();
|
||||
extern const char* infeasible_string(int);
|
||||
extern bool app_not_selected(WORKUNIT&);
|
||||
extern bool work_needed(SCHEDULER_REQUEST&, SCHEDULER_REPLY&, bool);
|
||||
extern bool work_needed(bool);
|
||||
|
|
|
@ -242,7 +242,7 @@ int add_download_servers(char *old_xml, char *new_xml, int tz) {
|
|||
|
||||
// advance pointer to start looking for next <url> tag.
|
||||
//
|
||||
p=r;
|
||||
p = r;
|
||||
}
|
||||
|
||||
strcpy(new_xml, r);
|
||||
|
@ -252,23 +252,21 @@ int add_download_servers(char *old_xml, char *new_xml, int tz) {
|
|||
// replace the download URL for apps with a list of
|
||||
// multiple download servers.
|
||||
//
|
||||
void process_av_timezone(
|
||||
SCHEDULER_REPLY& reply, APP_VERSION* avp, APP_VERSION& av2
|
||||
) {
|
||||
void process_av_timezone(APP_VERSION* avp, APP_VERSION& av2) {
|
||||
int retval;
|
||||
|
||||
// set these global variables, needed by the compare()
|
||||
// function so that the download URL list can be sorted by timezone
|
||||
//
|
||||
tzone=reply.host.timezone;
|
||||
hostid=reply.host.id;
|
||||
retval = add_download_servers(avp->xml_doc, av2.xml_doc, reply.host.timezone);
|
||||
tzone = g_reply->host.timezone;
|
||||
hostid = g_reply->host.id;
|
||||
retval = add_download_servers(avp->xml_doc, av2.xml_doc, g_reply->host.timezone);
|
||||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"add_download_servers(to APP version) failed\n"
|
||||
);
|
||||
// restore original WU!
|
||||
av2=*avp;
|
||||
av2 = *avp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,20 +274,20 @@ void process_av_timezone(
|
|||
// multiple download servers.
|
||||
//
|
||||
void process_wu_timezone(
|
||||
SCHEDULER_REPLY& reply, WORKUNIT& wu2, WORKUNIT& wu3
|
||||
WORKUNIT& wu2, WORKUNIT& wu3
|
||||
) {
|
||||
int retval;
|
||||
|
||||
tzone=reply.host.timezone;
|
||||
hostid=reply.host.id;
|
||||
tzone = g_reply->host.timezone;
|
||||
hostid = g_reply->host.id;
|
||||
|
||||
retval = add_download_servers(wu2.xml_doc, wu3.xml_doc, reply.host.timezone);
|
||||
retval = add_download_servers(wu2.xml_doc, wu3.xml_doc, g_reply->host.timezone);
|
||||
if (retval) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"add_download_servers(to WU) failed\n"
|
||||
);
|
||||
// restore original WU!
|
||||
wu3=wu2;
|
||||
wu3 = wu2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern void process_av_timezone(
|
||||
SCHEDULER_REPLY& reply, APP_VERSION* avp, APP_VERSION& av2
|
||||
);
|
||||
extern void process_av_timezone(APP_VERSION* avp, APP_VERSION& av2);
|
||||
|
||||
extern void process_wu_timezone(
|
||||
SCHEDULER_REPLY& reply, WORKUNIT& wu2, WORKUNIT& wu3
|
||||
);
|
||||
extern void process_wu_timezone(WORKUNIT& wu2, WORKUNIT& wu3);
|
||||
|
|
|
@ -610,7 +610,7 @@ int SCHEDULER_REPLY::write(FILE* fout, SCHEDULER_REQUEST& sreq) {
|
|||
);
|
||||
|
||||
if (config.request_time_stats_log) {
|
||||
if (!have_time_stats_log(*this)) {
|
||||
if (!have_time_stats_log()) {
|
||||
fprintf(fout, "<send_time_stats_log>1</send_time_stats_log>\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ void handle_time_stats_log(FILE* fin) {
|
|||
// The host has been authenticated, so write the stats.
|
||||
// Use a directory hierarchy since there may be many hosts
|
||||
//
|
||||
void write_time_stats_log(SCHEDULER_REPLY& reply) {
|
||||
void write_time_stats_log() {
|
||||
char dirname[256], filename[256];
|
||||
|
||||
int hostid = reply.host.id;
|
||||
int hostid = g_reply->host.id;
|
||||
int dirnum = hostid % 1000;
|
||||
sprintf(dirname, "../time_stats_log/%d", dirnum);
|
||||
if (!is_dir(dirname)) {
|
||||
|
@ -73,10 +73,10 @@ void write_time_stats_log(SCHEDULER_REPLY& reply) {
|
|||
stats_buf = 0;
|
||||
}
|
||||
|
||||
bool have_time_stats_log(SCHEDULER_REPLY& reply) {
|
||||
bool have_time_stats_log() {
|
||||
char filename[256];
|
||||
|
||||
int hostid = reply.host.id;
|
||||
int hostid = g_reply->host.id;
|
||||
int dirnum = hostid % 1000;
|
||||
sprintf(filename, "../time_stats_log/%d/%d", dirnum, hostid);
|
||||
return is_file(filename);
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
#include "server_types.h"
|
||||
|
||||
extern void handle_time_stats_log(FILE* fin);
|
||||
extern void write_time_stats_log(SCHEDULER_REPLY& reply);
|
||||
extern bool have_time_stats_log(SCHEDULER_REPLY& reply);
|
||||
extern void write_time_stats_log();
|
||||
extern bool have_time_stats_log();
|
||||
|
|
Loading…
Reference in New Issue