From aadf8133369c030827eafda26c5719a1820ff7e9 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 3 Mar 2009 00:12:55 +0000 Subject: [PATCH] - scheduler/feeder: add option; lets you intermix locality and job-cache scheduling From Bernd M. svn path=/trunk/boinc/; revision=17429 --- checkin_notes | 13 +++++++++++++ sched/file_deleter.cpp | 9 +++++++-- sched/handle_request.cpp | 4 ++-- sched/sched_config.cpp | 1 + sched/sched_config.h | 1 + sched/sched_send.cpp | 13 ++++++++++--- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/checkin_notes b/checkin_notes index 6227c9fe63..f04f0f87e7 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2473,6 +2473,7 @@ Rom 2 Mar 2009 David 2 Mar 2009 - scheduler: replace choose_download_url_by_timezone with replace_download_url_by_timezone. + From Bernd M. sched/ sched_timezone.cpp @@ -2484,3 +2485,15 @@ Rom 2 Mar 2009 curl/ + +David 2 Mar 2009 + - scheduler/feeder: add option; + lets you intermix locality and job-cache scheduling + From Bernd M. + + sched/ + feeder.cpp + handle_request.cpp + sched_config.cpp,h + sched_send.cpp + diff --git a/sched/file_deleter.cpp b/sched/file_deleter.cpp index b529d72fbf..5b10857437 100644 --- a/sched/file_deleter.cpp +++ b/sched/file_deleter.cpp @@ -68,7 +68,7 @@ #define DEFAULT_SLEEP_INTERVAL 5 #define RESULTS_PER_WU 4 // an estimate of redundancy -int id_modulus=0, id_remainder=0; +int id_modulus=0, id_remainder=0, appid=0; bool dont_retry_errors = false; bool dont_delete_antiques = false; bool dont_delete_batches = false; @@ -277,7 +277,10 @@ bool do_pass(bool retry_error) { if (dont_delete_batches) { strcat(clause, " and batch <= 0 "); } - + if (appid) { + sprintf(buf, " and appid = %d ", appid); + strcat(clause, buf); + } sprintf(buf, "where file_delete_state=%d %s limit %d", retry_error?FILE_DELETE_ERROR:FILE_DELETE_READY, @@ -592,6 +595,8 @@ int main(int argc, char** argv) { preserve_wu_files = true; } else if (!strcmp(argv[i], "-preserve_result_files")) { preserve_result_files = true; + } else if (!strcmp(argv[i], "-appid")) { + appid = atoi(argv[++i]); } else if (!strcmp(argv[i], "-d")) { log_messages.set_debug_level(atoi(argv[++i])); } else if (!strcmp(argv[i], "-mod")) { diff --git a/sched/handle_request.cpp b/sched/handle_request.cpp index d409bb429f..98fa11dda4 100644 --- a/sched/handle_request.cpp +++ b/sched/handle_request.cpp @@ -1212,7 +1212,7 @@ void process_request(char* code_sign_key) { } if (requesting_work()) { - if (config.locality_scheduling || config.enable_assignment) { + if (config.locality_scheduling || config.locality_scheduler_fraction || config.enable_assignment) { have_no_work = false; } else { lock_sema(); @@ -1475,7 +1475,7 @@ void handle_request(FILE* fin, FILE* fout, char* code_sign_key) { sreply.insert_message(USER_MESSAGE(buf, "low")); } - if (config.locality_scheduling && !sreply.nucleus_only) { + if ((config.locality_scheduling || config.locality_scheduler_fraction) && !sreply.nucleus_only) { send_file_deletes(); } diff --git a/sched/sched_config.cpp b/sched/sched_config.cpp index 54f1f5bd75..abf2b02584 100644 --- a/sched/sched_config.cpp +++ b/sched/sched_config.cpp @@ -108,6 +108,7 @@ int SCHED_CONFIG::parse(FILE* f) { if (xp.parse_int(tag, "uldl_dir_fanout", uldl_dir_fanout)) continue; if (xp.parse_int(tag, "locality_scheduling_wait_period", locality_scheduling_wait_period)) continue; if (xp.parse_int(tag, "locality_scheduling_send_timeout", locality_scheduling_send_timeout)) continue; + if (xp.parse_double(tag, "locality_scheduler_fraction", locality_scheduler_fraction)) continue; if (xp.parse_int(tag, "min_core_client_version", min_core_client_version)) continue; if (xp.parse_int(tag, "min_core_client_version_announced", min_core_client_version_announced)) continue; if (xp.parse_int(tag, "min_core_client_upgrade_deadline", min_core_client_upgrade_deadline)) continue; diff --git a/sched/sched_config.h b/sched/sched_config.h index 5ec4261aac..010d9ea31c 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -64,6 +64,7 @@ public: int uldl_dir_levels; int locality_scheduling_wait_period; int locality_scheduling_send_timeout; + double locality_scheduler_fraction; int min_core_client_version; int min_core_client_version_announced; int min_core_client_upgrade_deadline; diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index c0cf16a785..067bd8716b 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -25,8 +25,7 @@ #include #include #include - - +#include #include #include "error_numbers.h" @@ -1665,7 +1664,15 @@ void send_work() { ); } - if (config.locality_scheduling) { + if (config.locality_scheduler_fraction > 0) { + if (drand() < config.locality_scheduler_fraction) { + send_work_locality(); + send_work_old(); + } else { + send_work_old(); + send_work_locality(); + } + } else if (config.locality_scheduling) { g_wreq->infeasible_only = false; send_work_locality(); } else if (config.matchmaker) {