create results only in transitioner

svn path=/trunk/boinc/; revision=2126
This commit is contained in:
David Anderson 2003-08-15 23:44:28 +00:00
parent 2f34a97cad
commit c9b46365e7
9 changed files with 87 additions and 26 deletions

View File

@ -5798,3 +5798,20 @@ David Aug 15 2003
David Aug 15 2003
- changed "timeout_check" to "transitioner"
David Aug 15 2003
- changed logic so that create_work doesn't create any results;
this is left to the transitioner, since it does this anyway.
This required adding a result_template field to the workunit table,
which is the original result template macro-substituted
with the upload URL
db/
boinc_db.C,h
schema.sql
sched/
make_work.C
transitioner.C
tools/
backend_lib.C,h
process_result_template.C

View File

@ -581,7 +581,8 @@ void DB_WORKUNIT::db_print(char* buf){
"error_mask=%d, file_delete_state=%d, assimilate_state=%d, "
"workseq_next=%d, opaque=%d, "
"min_quorum=%d, target_nresults=%d, max_error_results=%d, "
"max_total_results=%d, max_success_results=%d",
"max_total_results=%d, max_success_results=%d, "
"result_template='%s'",
id, create_time, appid,
name, xml_doc, batch,
rsc_fpops, rsc_iops, rsc_memory, rsc_disk,
@ -594,7 +595,8 @@ void DB_WORKUNIT::db_print(char* buf){
target_nresults,
max_error_results,
max_total_results,
max_success_results
max_success_results,
result_template
);
}
@ -626,6 +628,7 @@ void DB_WORKUNIT::db_parse(MYSQL_ROW &r) {
max_error_results = atoi(r[i++]);
max_total_results = atoi(r[i++]);
max_success_results = atoi(r[i++]);
strcpy2(result_template, r[i++]);
}
void DB_RESULT::db_print(char* buf){

View File

@ -304,6 +304,7 @@ struct WORKUNIT {
// (need this in case results never returned
int max_success_results; // WU error if < #success results
// without consensus (i.e. WU is nondeterministic)
char result_template[MAX_BLOB_SIZE];
// the following not used in the DB
char app_name[256];

View File

@ -169,6 +169,7 @@ create table workunit (
max_error_results integer not null,
max_total_results integer not null,
max_success_results integer not null,
result_template blob,
primary key (id)
);

View File

@ -188,7 +188,7 @@ void make_work() {
sprintf(suffix, "%d_%d", start_time, seqno++);
create_result(
wu, result_template, suffix, key,
config.upload_url, config.download_url
config.upload_url
);
log_messages.printf(SchedMessages::DEBUG, "[%s_%s] Added result\n", wu.name, suffix);
nresults_left--;

View File

@ -291,6 +291,7 @@ void handle_wu(DB_WORKUNIT& wu) {
wu.id, wu.name, n
);
for (i=0; i<n; i++) {
#if 0
result = results[0];
make_unique_name(result.name);
initialize_result(result, wu);
@ -306,6 +307,18 @@ void handle_wu(DB_WORKUNIT& wu) {
);
break;
}
#endif
sprintf(suffix, "%d", results.size()+i);
strcpy(result_template, wu.result_template);
retval = create_result(wu, result_template, suffix, key, "");
if (retval) {
log_messages.printf(
SchedMessages::CRITICAL,
"[WU#%d %s] create_result() %d\n",
wu.id, wu.name, retval
);
break;
}
}
}
}

View File

@ -80,15 +80,6 @@ static int process_wu_template(
char open_name[256];
bool found=false;
#if 0
assert(wu_name!=NULL);
assert(tmplate!=NULL);
assert(out!=NULL);
assert(dirpath!=NULL);
assert(infiles!=NULL);
assert(n>=0);
#endif
strcpy(out, "");
p = strtok(tmplate, "\n");
while (p) {
@ -174,7 +165,7 @@ void initialize_result(DB_RESULT& result, DB_WORKUNIT& wu) {
int create_result(
DB_WORKUNIT& wu, char* result_template,
char* result_name_suffix, R_RSA_PRIVATE_KEY& key,
char* upload_url, char* download_url
char* upload_url
) {
DB_RESULT result;
char base_outfile_name[256];
@ -191,7 +182,7 @@ int create_result(
result_template_copy,
key,
base_outfile_name,
upload_url, download_url
upload_url
);
strcpy(result.xml_doc_in, result_template_copy);
@ -214,9 +205,7 @@ int create_work(
R_RSA_PRIVATE_KEY& key,
char* upload_url, char* download_url
) {
int i, retval;
char suffix[256];
char result_template[MAX_BLOB_SIZE];
int retval;
char _result_template[MAX_BLOB_SIZE];
char wu_template[MAX_BLOB_SIZE];
@ -230,6 +219,16 @@ int create_work(
fprintf(stderr, "process_wu_template: %d\n", retval);
return retval;
}
retval = read_filename(result_template_filename, _result_template);
if (retval) {
fprintf(stderr, "create_work: can't read result template\n");
return retval;
}
strcpy(wu.result_template, _result_template);
process_result_template_upload_url_only(wu.result_template, upload_url);
retval = wu.insert();
if (retval) {
fprintf(stderr, "create_work: workunit.insert() %d\n", retval);
@ -237,22 +236,22 @@ int create_work(
}
wu.id = boinc_db_insert_id();
retval = read_filename(result_template_filename, _result_template);
if (retval) {
fprintf(stderr, "create_work: can't read result template\n");
return retval;
}
#if 0
char suffix[256];
char result_template[MAX_BLOB_SIZE];
int i;
for (i=0; i<wu.target_nresults; i++) {
sprintf(suffix, "%d", i);
strcpy(result_template, _result_template);
retval = create_result(
wu, result_template, suffix, key, upload_url, download_url
wu, result_template, suffix, key, upload_url
);
if (retval) {
fprintf(stderr, "create_result: %d\n", retval);
break;
}
}
#endif
return 0;
}

View File

@ -26,7 +26,12 @@ extern int process_result_template(
char* result_template,
R_RSA_PRIVATE_KEY& key,
char* base_filename,
char* upload_url, char* download_url
char* upload_url
);
extern int process_result_template_upload_url_only(
char* result_template,
char* upload_url
);
extern int read_file(FILE*, char* buf);
@ -37,7 +42,7 @@ extern int read_key_file(char* keyfile, R_RSA_PRIVATE_KEY& key);
extern void initialize_result(DB_RESULT&, DB_WORKUNIT&);
extern int create_result(
DB_WORKUNIT& wu, char* result_template_filename, char* suffix,
R_RSA_PRIVATE_KEY& key, char* upload_url, char* download_url
R_RSA_PRIVATE_KEY& key, char* upload_url
);
extern int create_work(

View File

@ -113,7 +113,7 @@ int process_result_template(
char* result_template,
R_RSA_PRIVATE_KEY& key,
char* base_filename,
char* upload_url, char* download_url
char* upload_url
) {
char* p,*q;
char temp[MAX_BLOB_SIZE];
@ -143,3 +143,25 @@ int process_result_template(
}
return add_signatures(result_template, key);
}
// macro-substitute a result template only for UPLOAD_URL_MACRO
//
int process_result_template_upload_url_only(
char* result_template,
char* upload_url
) {
char *p;
char temp[MAX_BLOB_SIZE];
while (1) {
p = strstr(result_template, UPLOAD_URL_MACRO);
if (p) {
strcpy(temp, p+strlen(UPLOAD_URL_MACRO));
strcpy(p, upload_url);
strcat(p, temp);
continue;
}
break;
}
return 0;
}