- DB interface: in update(), check that 1 row was updated

- API: in APP_INIT_DATA, enclose project preferences in tags
    so that it's legal XML
- scheduler: add <multiple_clients_per_host> option.
    Use this if your project runs on Condor or grids
    and (to use multicore machines) you're running
    multiple clients per host.
    This will skip the host lookup based on IP address.


svn path=/trunk/boinc/; revision=15954
This commit is contained in:
David Anderson 2008-09-04 08:33:21 +00:00
parent e6ba967a60
commit cc7d507789
8 changed files with 55 additions and 4 deletions

View File

@ -7151,3 +7151,22 @@ David 4 Sep 2008
html/user/
white.css
David 4 Sep 2008
- DB interface: in update(), check that 1 row was updated
- API: in APP_INIT_DATA, enclose project preferences in tags
so that it's legal XML
- scheduler: add <multiple_clients_per_host> option.
Use this if your project runs on Condor or grids
and (to use multicore machines) you're running
multiple clients per host.
This will skip the host lookup based on IP address.
db/
db_base.C
lib/
app_ipc.C
parse.C,h
sched/
handle_request.C
sched_config.C,h

View File

@ -156,7 +156,10 @@ int DB_BASE::update() {
char vals[MAX_QUERY_LEN], query[MAX_QUERY_LEN];
db_print(vals);
sprintf(query, "update %s set %s where id=%d", table_name, vals, get_id());
return db->do_query(query);
int retval = db->do_query(query);
if (retval) return retval;
if (db->affected_rows() != 1) return ERR_DB_NOT_FOUND;
return 0;
}
// update one or more fields

View File

@ -198,7 +198,7 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) {
}
if (!strcmp(tag, "/app_init_data")) return 0;
if (!strcmp(tag, "project_preferences")) {
retval = dup_element_contents(f, "</project_preferences>", &ai.project_preferences);
retval = dup_element(f, "project_preferences", &ai.project_preferences);
if (retval) return retval;
continue;
}

View File

@ -146,7 +146,8 @@ int strcatdup(char*& p, char* buf) {
return 0;
}
// copy from a file to a malloc'd string until the end tag is reached
// Copy from a file to a malloc'd string until the end tag is reached
// Does NOT copy the start and end tags.
//
int dup_element_contents(FILE* in, const char* end_tag, char** pp) {
char buf[256];
@ -164,6 +165,28 @@ int dup_element_contents(FILE* in, const char* end_tag, char** pp) {
return ERR_XML_PARSE;
}
int dup_element(FILE* in, const char* tag_name, char** pp) {
char buf[256], end_tag[256];
int retval;
sprintf(buf, "<%s>\n", tag_name);
sprintf(end_tag, "</%s>", tag_name);
char* p = strdup(buf);
while (fgets(buf, 256, in)) {
if (strstr(buf, end_tag)) {
sprintf(buf, "</%s>\n", tag_name);
retval = strcatdup(p, buf);
if (retval) return retval;
*pp = p;
return 0;
}
retval = strcatdup(p, buf);
if (retval) return retval;
}
return ERR_XML_PARSE;
}
// copy from a file to static buffer
//
int copy_element_contents(FILE* in, const char* end_tag, char* p, int len) {

View File

@ -114,6 +114,7 @@ extern bool parse_bool(const char*, const char*, bool&);
extern int copy_stream(FILE* in, FILE* out);
extern int strcatdup(char*& p, char* buf);
extern int dup_element_contents(FILE* in, const char* end_tag, char** pp);
extern int dup_element(FILE* in, const char* end_tag, char** pp);
extern int copy_element_contents(FILE* in, const char* end_tag, char* p, int len);
extern int copy_element_contents(FILE* in, const char* end_tag, std::string&);
extern void replace_element_contents(

View File

@ -396,7 +396,10 @@ make_new_host:
// If found, use the existing host record,
// and mark in-progress results as over.
//
if (find_host_by_other(user, sreq.host, host)) {
// NOTE: if the project allows multiple clients per host
// (e.g. those that run on grids), skip this.
//
if (!config.multiple_clients_per_host && find_host_by_other(user, sreq.host, host)) {
log_messages.printf(MSG_NORMAL,
"[HOST#%d] [USER#%d] Found similar existing host for this user - assigned.\n",
host.id, host.userid

View File

@ -189,6 +189,7 @@ int SCHED_CONFIG::parse(FILE* f) {
if (xp.parse_int(tag, "mm_max_slots", mm_max_slots)) continue;
if (xp.parse_bool(tag, "job_size_matching", job_size_matching)) continue;
if (xp.parse_bool(tag, "use_credit_multiplier", use_credit_multiplier)) continue;
if (xp.parse_bool(tag, "multiple_clients_per_host", multiple_clients_per_host)) continue;
if (xp.parse_bool(tag, "debug_version_select", debug_version_select)) continue;

View File

@ -125,6 +125,7 @@ public:
int mm_max_slots;
bool job_size_matching;
bool use_credit_multiplier;
bool multiple_clients_per_host;
// log flags
//