- scheduler: add <locality_scheduling_sticky_file>

and <locality_scheduling_workunit_file> options
    From Bernd M.

svn path=/trunk/boinc/; revision=17431
This commit is contained in:
David Anderson 2009-03-03 00:25:41 +00:00
parent e36e700f22
commit 66ec889431
4 changed files with 60 additions and 5 deletions

View File

@ -2498,3 +2498,11 @@ David 2 Mar 2009
handle_request.cpp
sched_config.cpp,h
sched_send.cpp
David 2 Mar 2009
- scheduler: add <locality_scheduling_sticky_file>
and <locality_scheduling_workunit_file> options
From Bernd M.
sched/
sched_config.cpp,h
sched_locality.cpp

View File

@ -54,6 +54,8 @@ int SCHED_CONFIG::parse(FILE* f) {
memset(this, 0, sizeof(*this));
ban_os = new vector<regex_t>;
ban_cpu = new vector<regex_t>;
locality_scheduling_workunit_file = new vector<regex_t>;
locality_scheduling_sticky_file = new vector<regex_t>;
max_wus_to_send = 10;
default_disk_max_used_gb = 100.;
default_disk_max_used_pct = 50.;
@ -108,6 +110,24 @@ 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_str(tag, "locality_scheduling_workunit_file", buf, sizeof(buf))) {
retval = regcomp(&re, buf, REG_EXTENDED|REG_NOSUB);
if (retval) {
log_messages.printf(MSG_CRITICAL, "BAD REGEXP: %s\n", buf);
} else {
locality_scheduling_workunit_file->push_back(re);
}
continue;
}
if (xp.parse_str(tag, "locality_scheduling_sticky_file", buf, sizeof(buf))) {
retval = regcomp(&re, buf, REG_EXTENDED|REG_NOSUB);
if (retval) {
log_messages.printf(MSG_CRITICAL, "BAD REGEXP: %s\n", buf);
} else {
locality_scheduling_sticky_file->push_back(re);
}
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;

View File

@ -64,6 +64,8 @@ public:
int uldl_dir_levels;
int locality_scheduling_wait_period;
int locality_scheduling_send_timeout;
vector<regex_t> *locality_scheduling_workunit_file;
vector<regex_t> *locality_scheduling_sticky_file;
double locality_scheduler_fraction;
int min_core_client_version;
int min_core_client_version_announced;

View File

@ -997,6 +997,25 @@ bool file_info_order(const FILE_INFO& fi1, const FILE_INFO& fi2) {
return false;
}
bool is_sticky_file(char*fname) {
for (unsigned int i=0; i<config.locality_scheduling_sticky_file->size(); i++) {
if (!regexec(&((*config.locality_scheduling_sticky_file)[i]), fname, 0, NULL, 0)) {
return true;
}
}
return false;
}
bool is_workunit_file(char*fname) {
for (unsigned int i=0; i<config.locality_scheduling_workunit_file->size(); i++) {
if (!regexec(&((*config.locality_scheduling_workunit_file)[i]), fname, 0, NULL, 0)) {
return true;
}
}
return false;
}
void send_work_locality() {
int i, nsent, nfiles, j;
@ -1024,16 +1043,22 @@ void send_work_locality() {
strncmp("l1_", fname, 3) &&
strncmp("L1_", fname, 3)
);
#if 0
// here, put a list of patterns of ALL files that are still needed to be
// sticky, but are not 'data' files for locality scheduling purposes, eg they
// do not have associated WU with names FILENAME__*
//
bool data_files = strncmp("grid_", fname, 5) && strncmp("skygrid_", fname, 8) && strncmp("Config_", fname, 7);
if (strlen(fname)==15 && !strncmp("l1_", fname, 3)) data_files = false;
bool data_files =
strncmp("grid_", fname, 5)
&& strncmp("skygrid_", fname, 8)
&& strncmp("Config_", fname, 7);
if (strlen(fname)==15 && !strncmp("l1_", fname, 3)) {
data_files = false;
}
#endif
if (!useful) {
if (is_workunit_file(fname)) {
// these files WILL be deleted from the host
//
g_request->files_not_needed.push_back(eah_copy[i]);
@ -1043,7 +1068,7 @@ void send_work_locality() {
g_reply->host.id, fname
);
}
} else if (!data_files) {
} else if (is_sticky_file(fname)) {
// these files MIGHT be deleted from host if we need to make
// disk space there
//