*** empty log message ***

svn path=/trunk/boinc/; revision=12004
This commit is contained in:
David Anderson 2007-01-30 18:19:30 +00:00
parent 15500a0e43
commit ff91c8450f
17 changed files with 119 additions and 161 deletions

View File

@ -1365,4 +1365,29 @@ Rom 30 Jan 2007
AdvancedFrame.cpp, .h
BOINCBaseFrame.cpp, .h
MainDocument.cpp, .h
David 30 Jan 2007
- Support projects that want to specify credit per WU can do so by:
1) add a <credit>x</credit> element to your WU template,
or pass an 'additional_xml' argument containing
<credit>x</credit> to create_work()
(either the function or the program)
2) change your validator so that compute_granted_credit()
calls get_credit_from_wu().
This parses the <credit> element in the workunit's XML,
and grants that much credit.
- Change the simple validator framework so that an
additional WORKUNIT& is passed to compute_granted_credit().
sched/
handle_request.C
sample_bitwise_validator.C
sample_trivial_validator.C
sched_config.C,h
transitioner.C
validate_util.C,h
validate_util2.C,h
validator_placeholder.C
tools/
backend_lib.C,h
create_work.C

View File

@ -1,49 +0,0 @@
<?php
require_once("docutil.php");
page_head("Building the server");
echo"
See the <a href=build.php>Software Prerequisites</a>.
<h2>Overview</h2>
Download:
<pre>
wget http://boinc.berkeley.edu/source/boinc-VERSION.tar.gz
tar xvzf boinc-VERSION.tar.gz
cd boinc-VERSION
</pre>
Configure:
<pre>
./configure
</pre>
Make:
<pre>
make
</pre>
Check:
<pre>
make check
</pre>
<h2>Troubleshooting</h2>
<h3>MySQL</h3>
BOINC gets MySQL compiler and linker flags from a program
called <code>mysql_config</code> which comes with your MySQL distribution.
This sometimes references libraries that are not part of your base system
installation, such as <code>-lnsl</code> or <code>-lnss_files</code>.
You may need to install additional packages
(often you can use something called 'mysql-dev' or 'mysql-devel')
or fiddle with Makefiles.
<h3>MySQL transactions </h3>
If you get messages such as this:
<pre>
Database error: You have an error in your SQL syntax near 'START TRANSACTION' at line 1 query=START TRANSACTION
</pre>
then your MySQL server does not support transactions. Either upgrade to MySQL
4.x, or remove <code>&lt;use_transactions/&gt;</code> from config.xml
";
page_tail();
?>

View File

@ -63,17 +63,28 @@ A workunit template file has the form
[ <max_error_results>x</max_error_results> ]
[ <max_total_results>x</max_total_results> ]
[ <max_success_results>x</max_success_results> ]
[ <credit>X</credit> ]
</workunit>
"), "
</pre>
The components are:
";
list_start();
list_item(htmlspecialchars("<file_info>, <file_ref>"),
"Each pair describes an <a href=files.php#file>input file</a>
and <a href=files.php#file_ref>the way it's referenced</a>.");
list_item(htmlspecialchars("<command_line>"),
"The command-line arguments to be passed to the main program.");
list_item_func("<file_info>, <file_ref>",
"Each pair describes an <a href=files.php#file>input file</a>
and <a href=files.php#file_ref>the way it's referenced</a>."
);
list_item_func("<command_line>",
"The command-line arguments to be passed to the main program."
);
list_item_func("<credit>",
"The amount of credit to be granted for successful completion
of this workunit.
Use this only if you know in advance
how many FLOPs it will take.
Your <a href=validate_simple.php>validator</a> must
use get_credit_from_wu() as its compute_granted_credit() function."
);
list_item("Other elements",
"<a href=work.php>Work unit attributes</a>"
);
@ -192,11 +203,14 @@ create_work
[ -max_error_results x ]
[ -max_total_results x ]
[ -max_success_results x ]
[ -additional_xml 'x' ]
infile_1 ... infile_m // input files
</pre>
The workunit parameters are documented <a href=work.php>here</a>.
The program must be run in the project root directory.
The workunit parameters are documented <a href=work.php>here</a>.
The -additional_xml argument can be used to supply, for example,
&lt;credit>12.4&lt;/credit>.
<p>
BOINC's library (backend_lib.C,h) provides the functions:
@ -209,7 +223,8 @@ int create_work(
const char** infiles, // array of input file names
int ninfiles
SCHED_CONFIG&,
const char* command_line = NULL
const char* command_line = NULL,
const char* additional_xml = NULL
);
</pre>
<p>

View File

@ -585,16 +585,16 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
int retval;
RESULT* rp;
bool changed_host=false;
if (sreq.results.size() == 0) return 0;
// copy reported results to a separate vector, "result_handler",
// initially with only the "name" field present
//
for (i=0; i<sreq.results.size(); i++) {
result_handler.add_result(sreq.results[i].name);
}
// read results from database into "result_handler".
// Quantities that must be read from the DB are those
// where srip (see below) appears as an rval.
@ -700,7 +700,7 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
srip->id = 0;
reply.result_acks.push_back(std::string(rp->name));
continue;
}
}
}
if (srip->server_state == RESULT_SERVER_STATE_UNSENT) {
@ -833,19 +833,6 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
}
} // loop over all incoming results
#if 0
if (config.use_transactions) {
retval = boinc_db.start_transaction();
if (retval) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
"[HOST#%d] result_handler.start_transaction() == %d\n",
reply.host.id, retval
);
}
}
#endif
// Update the result records
// (skip items that we previously marked to skip)
//
@ -874,19 +861,6 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
reply.host.id, retval
);
}
#if 0
if (config.use_transactions) {
retval = boinc_db.commit_transaction();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::MSG_CRITICAL,
"[HOST#%d] result_handler.commit_transaction() == %d\n",
reply.host.id, retval
);
}
}
#endif
return 0;
}
@ -958,28 +932,26 @@ void warn_user_if_core_client_upgrade_scheduled(
) {
int core_ver;
core_ver = sreq.core_client_major_version*100;
core_ver += sreq.core_client_minor_version;
if (core_ver < config.min_core_client_version_announced) {
// time remaining in hours, before upgrade required
int remaining = config.min_core_client_upgrade_deadline-time(0);
remaining /= 3600;
if (0 < remaining) {
char msg[512];
int days = remaining / 24;
int hours = remaining % 24;
sprintf(msg,
"Starting in %d days and %d hours, project will require a minimum "
"BOINC core client version of %d.%d.0. You are currently using "
"version %d.%d.%d; please upgrade before this time.",
days, hours,
config.min_core_client_version_announced / 100,
config.min_core_client_version_announced / 100,
config.min_core_client_version_announced % 100,
sreq.core_client_major_version,
sreq.core_client_minor_version,
@ -1018,10 +990,10 @@ bool unacceptable_os(
sreq.host.os_name, sreq.host.os_version
);
if (!strcmp(sreq.host.os_name, "Darwin") &&
(!strncmp(sreq.host.os_version, "5.", 2) ||
if (!strcmp(sreq.host.os_name, "Darwin") &&
(!strncmp(sreq.host.os_version, "5.", 2) ||
!strncmp(sreq.host.os_version, "6.", 2)
)
)
) {
log_messages.printf(
SCHED_MSG_LOG::MSG_NORMAL,
@ -1040,7 +1012,7 @@ bool unacceptable_os(
}
#else
bool unacceptable_os(
SCHEDULER_REQUEST& , SCHEDULER_REPLY&
SCHEDULER_REQUEST& , SCHEDULER_REPLY&
) {
return false;
}
@ -1277,7 +1249,7 @@ void process_request(
reply.set_delay(DELAY_PLATFORM_UNSUPPORTED);
goto leave;
}
handle_global_prefs(sreq, reply);
handle_results(sreq, reply);
@ -1344,9 +1316,9 @@ void debug_sched(
sprintf(tmpfilename, "sched_reply_%06d_%06d", sreq.hostid, sreq.rpc_seqno);
// use _XXXXXX if you want random filenames rather than
// deterministic mkstemp(tmpfilename);
fp=fopen(tmpfilename, "w");
if (!fp) {
log_messages.printf(
SCHED_MSG_LOG::MSG_CRITICAL,
@ -1354,15 +1326,15 @@ void debug_sched(
);
return;
}
log_messages.printf(
SCHED_MSG_LOG::MSG_DEBUG,
"Found %s, so writing %s\n", trigger, tmpfilename
);
sreply.write(fp);
fclose(fp);
sprintf(tmpfilename, "sched_request_%06d_%06d", sreq.hostid, sreq.rpc_seqno);
fp=fopen(tmpfilename, "w");
@ -1411,7 +1383,7 @@ void handle_request(
if (rm && !strcmp(rm, "GET")) {
sreply.probable_user_browser=true;
}
log_messages.printf(
SCHED_MSG_LOG::MSG_NORMAL,
"Incomplete request received %sfrom IP %s, auth %s, platform %s, version %d.%d.%d\n",
@ -1420,7 +1392,7 @@ void handle_request(
sreq.core_client_major_version, sreq.core_client_minor_version,
sreq.core_client_release
);
USER_MESSAGE um("Incomplete request received.", "low");
sreply.insert_message(um);
sreply.nucleus_only = true;
@ -1443,15 +1415,15 @@ void handle_request(
int i;
for (i=0; i<num_useless; i++) {
char buf[256];
FILE_INFO& fi = sreq.files_not_needed[i];
sreply.file_deletes.push_back(fi);
log_messages.printf(
SCHED_MSG_LOG::MSG_DEBUG,
"[HOST#%d]: delete file %s (not needed)\n", sreply.host.id, fi.name
FILE_INFO& fi = sreq.files_not_needed[i];
sreply.file_deletes.push_back(fi);
log_messages.printf(
SCHED_MSG_LOG::MSG_DEBUG,
"[HOST#%d]: delete file %s (not needed)\n", sreply.host.id, fi.name
);
sprintf(buf, "BOINC will delete file %s (no longer needed)", fi.name);
USER_MESSAGE um(buf, "low");
sreply.insert_message(um);
sprintf(buf, "BOINC will delete file %s (no longer needed)", fi.name);
USER_MESSAGE um(buf, "low");
sreply.insert_message(um);
}
#endif
@ -1464,7 +1436,7 @@ void handle_request(
//
delete_file_from_host(sreq, sreply);
}
// write all messages to log file
for (unsigned int i=0; i<sreply.messages.size(); i++) {
USER_MESSAGE um = sreply.messages[i];
@ -1486,7 +1458,7 @@ void handle_request(
debug_sched(sreq, sreply, "../debug_sched");
}
#endif
sreply.write(fout);
if (strlen(config.sched_lockfile_dir)) {

View File

@ -100,8 +100,8 @@ int cleanup_result(RESULT const& /*result*/, void* data) {
return 0;
}
double compute_granted_credit(vector<RESULT>& results) {
return median_mean_credit(results);
double compute_granted_credit(WORKUNIT& wu, vector<RESULT>& results) {
return median_mean_credit(wu, results);
}
const char *BOINC_RCSID_7ab2b7189c = "$Id$";

View File

@ -44,8 +44,8 @@ int cleanup_result(RESULT const&, void*) {
return 0;
}
double compute_granted_credit(vector<RESULT>& results) {
return median_mean_credit(results);
double compute_granted_credit(WORKUNIT& wu, vector<RESULT>& results) {
return median_mean_credit(wu, results);
}
const char *BOINC_RCSID_f3a7a34795 = "$Id$";

View File

@ -87,7 +87,6 @@ int SCHED_CONFIG::parse(FILE* f) {
else if (xp.parse_bool(tag, "ignore_upload_certificates", ignore_upload_certificates)) continue;
else if (xp.parse_bool(tag, "dont_generate_upload_certificates", dont_generate_upload_certificates)) continue;
else if (xp.parse_bool(tag, "ignore_delay_bound", ignore_delay_bound)) continue;
else if (xp.parse_bool(tag, "use_transactions", use_transactions)) continue;
else if (xp.parse_int(tag, "min_sendwork_interval", min_sendwork_interval)) continue;
else if (xp.parse_int(tag, "max_wus_to_send", max_wus_to_send)) continue;
else if (xp.parse_int(tag, "daily_result_quota", daily_result_quota)) continue;

View File

@ -51,7 +51,6 @@ public:
bool ignore_upload_certificates;
bool dont_generate_upload_certificates;
bool ignore_delay_bound;
bool use_transactions;
int daily_result_quota; // max results per host per day
int uldl_dir_fanout; // fanout of ul/dl dirs; 0 if none
int uldl_dir_levels;

View File

@ -487,7 +487,7 @@ int handle_wu(
int long_delay = (int)(1.5*wu_item.delay_bound);
wu_item.transition_time = (long_delay > ten_days) ? long_delay : ten_days;
wu_item.transition_time += time(0);
}
}
for (i=0; i<items.size(); i++) {
TRANSITIONER_ITEM& res_item = items[i];
if (res_item.res_id) {
@ -497,7 +497,7 @@ int handle_wu(
// sent_time + delay_bound
// because the sent_time has been updated with the later
// "resend" time.
//
//
// x = res_item.res_sent_time + wu_item.delay_bound;
x = res_item.res_report_deadline;
if (x < wu_item.transition_time) {
@ -550,18 +550,6 @@ bool do_pass() {
if (!one_pass) check_stop_daemons();
#if 0
if (config.use_transactions) {
retval = boinc_db.start_transaction();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::MSG_CRITICAL,
"transitioner.start_transaction() == %d\n", retval
);
}
}
#endif
// loop over entries that are due to be checked
//
while (!transitioner.enumerate((int)time(0), SELECT_LIMIT, mod_n, mod_i, items)) {
@ -581,20 +569,6 @@ bool do_pass() {
if (!one_pass) check_stop_daemons();
}
#if 0
if (config.use_transactions) {
retval = boinc_db.commit_transaction();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::MSG_CRITICAL,
"[WU#%d %s] transitioner.commit_transaction() == %d\n",
wu_item.id, wu_item.name, retval
);
}
}
#endif
return did_something;
}

View File

@ -103,7 +103,7 @@ int get_output_file_paths(RESULT const& result, vector<string>& paths) {
// - if N==2, return min
// - if N>2, toss out min and max, return average of rest
//
double median_mean_credit(vector<RESULT>& results) {
double median_mean_credit(WORKUNIT& /*wu*/, vector<RESULT>& results) {
int ilow=-1, ihigh=-1;
double credit_low = 0, credit_high = 0;
int nvalid = 0;
@ -149,6 +149,15 @@ double median_mean_credit(vector<RESULT>& results) {
}
}
double get_credit_from_wu(WORKUNIT& wu, vector<RESULT>&) {
double x;
if (parse_double(wu.xml_doc, "<credit>", x)) {
return x;
}
fprintf(stderr, "ERROR: <credit> missing from WU XML\n");
exit(1);
}
// This function should be called from the validator whenever credit
// is granted to a host. It's purpose is to track the average credit
// per cpu time for that host.

View File

@ -27,7 +27,7 @@
extern int get_output_file_path(RESULT const& result, std::string& path);
extern int get_output_file_paths(RESULT const& result, std::vector<std::string>&);
extern double median_mean_credit(std::vector<RESULT>& results);
extern double median_mean_credit(WORKUNIT&, std::vector<RESULT>& results);
extern int update_credit_per_cpu_sec(
double credit, double cpu_time, double& credit_per_cpu_sec
);

View File

@ -125,7 +125,7 @@ int check_set(
}
}
canonicalid = results[i].id;
credit = compute_granted_credit(results);
credit = compute_granted_credit(wu, results);
break;
}
}

View File

@ -6,6 +6,6 @@
extern int init_result(RESULT const&, void*&);
extern int compare_results(RESULT &, void*, RESULT const&, void*, bool&);
extern int cleanup_result(RESULT const&, void*);
extern double compute_granted_credit(std::vector<RESULT>& results);
extern double compute_granted_credit(WORKUNIT&, std::vector<RESULT>& results);
#endif

View File

@ -100,8 +100,8 @@ int cleanup_result(RESULT const& /*result*/, void* data) {
return 0;
}
double compute_granted_credit(vector<RESULT>& results) {
return median_mean_credit(results);
double compute_granted_credit(WORKUNIT& wu, vector<RESULT>& results) {
return median_mean_credit(wu, results);
}
const char *BOINC_RCSID_7ab2b7189c = "$Id$";

View File

@ -166,7 +166,8 @@ static int process_wu_template(
const char** infiles,
int ninfiles,
SCHED_CONFIG& config,
const char* command_line
const char* command_line,
const char* additional_xml
) {
char* p;
char buf[LARGE_BLOB_SIZE], md5[33], path[256], url[256], top_download_path[256];
@ -269,6 +270,10 @@ static int process_wu_template(
out += "\n</command_line>\n";
}
} else if (match_tag(p, "</workunit>")) {
if (additional_xml && strlen(additional_xml)) {
out += additional_xml;
out += "\n";
}
out += "</workunit>\n";
} else if (match_tag(p, "<file_ref>")) {
out += "<file_ref>\n";
@ -486,7 +491,8 @@ int create_work(
const char** infiles,
int ninfiles,
SCHED_CONFIG& config,
const char* command_line
const char* command_line,
const char* additional_xml
) {
int retval;
char _result_template[LARGE_BLOB_SIZE];
@ -503,7 +509,7 @@ int create_work(
strcpy(wu_template, _wu_template);
wu.create_time = time(0);
retval = process_wu_template(
wu, wu_template, infiles, ninfiles, config, command_line
wu, wu_template, infiles, ninfiles, config, command_line, additional_xml
);
if (retval) {
fprintf(stderr, "process_wu_template: %d\n", retval);

View File

@ -56,7 +56,8 @@ extern int create_work(
const char** infiles,
int ninfiles,
SCHED_CONFIG&,
const char* command_line = NULL
const char* command_line = NULL,
const char* additional_xml = NULL
);
#endif

View File

@ -41,6 +41,7 @@
// [ -max_error_results x ]
// [ -max_total_results x ]
// [ -max_success_results x ]
// [ -additional_xml x ]
// infile1 infile2 ...
//
@ -64,13 +65,16 @@ int main(int argc, const char** argv) {
char* command_line=NULL;
const char** infiles = NULL;
int i, ninfiles;
char download_dir[256], db_name[256], db_passwd[256],db_user[256],db_host[256];
char download_dir[256], db_name[256], db_passwd[256];
char db_user[256],db_host[256];
char buf[256];
char additional_xml[256];
SCHED_CONFIG config;
strcpy(result_template_file, "");
strcpy(app.name, "");
strcpy(db_passwd, "");
strcpy(additional_xml, "");
const char* config_dir = ".";
i = 1;
ninfiles = 0;
@ -128,6 +132,8 @@ int main(int argc, const char** argv) {
wu.max_success_results = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-command_line")) {
command_line= (char *)argv[++i];
} else if (!strcmp(argv[i], "-additional_xml")) {
strcpy(additional_xml, argv[++i]);
} else {
if (!strncmp("-",argv[i],1)) {
fprintf(stderr, "create_work: bad argument '%s'\n", argv[i]);
@ -192,7 +198,8 @@ int main(int argc, const char** argv) {
const_cast<const char **>(infiles),
ninfiles,
config,
command_line
command_line,
additional_xml
);
if (retval) {
fprintf(stderr, "create_work: %d\n", retval);