mirror of https://github.com/BOINC/boinc.git
- scheduler: add optional <host_summary_regex> element to plan_class_spec.xml.
This regular expression is matched against the "host summary" string stored in host.serialnum. You can use this, e.g., to allow only particular GPU models.
This commit is contained in:
parent
6dfe0b31ac
commit
7abfe40063
|
@ -93,6 +93,20 @@ bool PLAN_CLASS_SPEC::check(SCHEDULER_REQUEST& sreq, HOST_USAGE& hu) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// host summary
|
||||
//
|
||||
if (have_host_summary_regex
|
||||
&& regexec(&(host_summary_regex), g_reply->host.serialnum, 0, NULL, 0)
|
||||
) {
|
||||
if (config.debug_version_select) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[version] plan_class_spec: host summary '%s' didn't match regexp\n",
|
||||
g_reply->host.serialnum
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// OS version
|
||||
//
|
||||
if (have_os_regex && regexec(&(os_regex), sreq.host.os_version, 0, NULL, 0)) {
|
||||
|
@ -632,6 +646,14 @@ int PLAN_CLASS_SPEC::parse(XML_PARSER& xp) {
|
|||
have_os_regex = true;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("host_summary_regex", buf, sizeof(buf))) {
|
||||
if (regcomp(&(host_summary_regex), buf, REG_EXTENDED|REG_NOSUB) ) {
|
||||
log_messages.printf(MSG_CRITICAL, "BAD REGEXP: %s\n", buf);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
have_host_summary_regex = true;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("project_prefs_tag", project_prefs_tag, sizeof(project_prefs_tag))) continue;
|
||||
if (xp.parse_str("project_prefs_regex", buf, sizeof(buf))) {
|
||||
if (regcomp(&(project_prefs_regex), buf, REG_EXTENDED|REG_NOSUB) ) {
|
||||
|
@ -710,6 +732,7 @@ PLAN_CLASS_SPEC::PLAN_CLASS_SPEC() {
|
|||
max_threads = 1;
|
||||
projected_flops_scale = 1;
|
||||
have_os_regex = false;
|
||||
have_host_summary_regex = false;
|
||||
strcpy(project_prefs_tag, "");
|
||||
have_project_prefs_regex = false;
|
||||
avg_ncpus = 0;
|
||||
|
|
|
@ -44,6 +44,8 @@ struct PLAN_CLASS_SPEC {
|
|||
int min_core_client_version;
|
||||
int max_core_client_version;
|
||||
// for non-compute-intensive, or override for GPU apps
|
||||
bool have_host_summary_regex;
|
||||
regex_t host_summary_regex;
|
||||
|
||||
// GPU apps
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue