*** empty log message ***

svn path=/trunk/boinc/; revision=3880
This commit is contained in:
David Anderson 2004-07-15 18:54:17 +00:00
parent d30df3c4d1
commit ecf08e05cd
16 changed files with 159 additions and 79 deletions

View File

@ -15248,3 +15248,38 @@ Brian 14 July 2004
Rom July 15 2004
- Tag for 4.00 release, all platforms
boinc_release_4_00
David
- server: better messages on DB errors
- web: cache system looks for "format=xml" in cache args,
sends as MIME type XML if so
- added CGI interface to get user stats as XML
- top_*.php: forgot to exit() in case of too-large offset
- xml_escape(): change \n to space
- db_dump: error checking; add fields to team output;
only output items with nonzero total_credit
- scheduler: we were doing an optimization of not opening the DB
in case there's no work and client not returning results.
Don't do this if this is initial request from host
(otherwise it won't get hostid, and will detach project)
- add "enforce_delay_bound" to SCHED_CONFIG
(NOTE TO PROJECTS: unless you pub <enforce_delay_bound/>
in your config.xml, the scheduler will send results
to hosts that are too slow to complete them within delay bound.)
db/
db_base.C
html/
inc/
cache.inc
user/
account_created.php
download.php
show_user.php
top_*.php
lib/
parse.C,h
sched/
db_dump.C
handle_request.C
sched_config.C,h

View File

@ -30,7 +30,7 @@ int DB_CONN::do_query(char* p) {
int retval;
retval = mysql_query(mysql, p);
if (retval) {
fprintf(stderr, "Database error: query=%s\n", p);
fprintf(stderr, "Database error: %s\nquery=%s\n", error_string(), p);
}
return retval;
}
@ -53,11 +53,7 @@ int DB_CONN::insert_id() {
}
void DB_CONN::print_error(char* p) {
if (mysql) {
fprintf(stderr, "%s: Database error: %s\n", p, mysql_error(mysql));
} else {
fprintf(stderr, "%s: Database error\n", p);
}
fprintf(stderr, "%s: Database error: %s\n", p, error_string());
}
const char* DB_CONN::error_string() {
@ -167,6 +163,10 @@ int DB_BASE::enumerate(char* clause) {
x = db->do_query(query);
if (x) return mysql_errno(db->mysql);
// can't use mysql_use_results() here; if you do,
// any other transactions will fail
//
cursor.rp = mysql_store_result(db->mysql);
if (!cursor.rp) return mysql_errno(db->mysql);
}

View File

@ -24,6 +24,9 @@ function start_cache($max_age, $params=""){
} else {
// Otherwise serve the cached version and exit
//
if (strstr($params, "format=xml")) {
header('Content-type: text/xml');
}
readfile($path);
exit;
}

View File

@ -10,7 +10,11 @@
<p>
Your <b>account ID</b> has been emailed to $email_addr.
<br>
Please wait until you receive this email (it may take a minute or two).
Please wait until you receive this email.
If it doesn't arrive in a minute or two,
your ISP may be blocking it as 'spam'.
In this case please contact your ISP and
ask them to not block email from ".URL_BASE.".
";
} else {
echo "<h3>Activate your ".PROJECT." account</h3>\n";

View File

@ -36,7 +36,10 @@ require_once("../inc/download.inc");
<p>
If your computer is not one of the above types,
you can
<a href=http://boinc.berkeley.edu/anonymous_platform.php>download and compile the BOINC software yourself</a>.
<ul>
<li> <a href=http://boinc.berkeley.edu/anonymous_platform.php>download and compile the BOINC software yourself</a> or
<li> <a href=download_other.php>download from a third-party site</a>.
</ul>
<p>
BOINC can be customized for
<a href=http://boinc.berkeley.edu/language.php>languages other than English</a>

View File

@ -1,25 +1,42 @@
<?php
require_once("../inc/db.inc");
require_once("../inc/cache.inc");
require_once("../inc/util.inc");
require_once("../inc/user.inc");
init_session();
db_init();
$id = $_GET["userid"];
$format = $_GET["format"];
$cache_args = "userid=$id";
if ($format) {
$cache_args .= "&format=xml";
}
start_cache(600, $cache_args);
require_once("../inc/db.inc");
require_once("../inc/user.inc");
db_init();
$result = mysql_query("select * from user where id = $id");
$user = mysql_fetch_object($result);
mysql_free_result($result);
if ($user) {
page_head("Account data for $user->name");
start_table();
show_user_summary_public($user);
end_table();
page_tail();
if ($format == "xml") {
require_once("../inc/xml.inc");
if ($user) {
show_user_xml($user);
} else {
xml_error("no such user ID");
}
} else {
page_head("Can't find user");
echo "There is no account with that id.\n<p>";
page_tail();
if ($user) {
page_head("Account data for $user->name");
start_table();
show_user_summary_public($user);
end_table();
page_tail();
} else {
page_head("Can't find user");
echo "There is no account with that ID.\n<p>";
page_tail();
}
}
end_cache($cache_args);
?>

View File

@ -18,7 +18,7 @@
page_head("Limit exceeded");
echo "Sorry - first 1000 only.";
page_tail();
exit();
}
require_once("../inc/db.inc");

View File

@ -18,7 +18,7 @@
page_head("Limit exceeded");
echo "Sorry - first 1000 only.";
page_tail();
exit();
}
require_once("../inc/db.inc");

View File

@ -18,6 +18,7 @@
page_head("Limit exceeded");
echo "Sorry - first 1000 only.";
page_tail();
exit();
}
require_once("../inc/db.inc");

View File

@ -271,12 +271,19 @@ void xml_escape(string& in, string& out) {
out += "&lt;";
} else if (in[i] == '&') {
out += "&amp;";
} else if (in[i] == '\n') {
out += " ";
} else {
out += in[i];
}
}
}
void xml_escape(char* in, string& out) {
string foo = in;
xml_escape(foo, out);
}
void xml_unescape(string& in, string& out) {
int i;
out = "";
@ -292,4 +299,3 @@ void xml_unescape(string& in, string& out) {
}
}
}

View File

@ -43,6 +43,7 @@ extern int read_file_malloc(const char* pathname, char*& str);
extern void replace_element(char* buf, char* start, char* end, char* replacement);
extern char* sgets(char* buf, int len, char* &in);
extern void xml_escape(std::string&, std::string&);
extern void xml_escape(char*, std::string&);
extern void xml_unescape(std::string&, std::string&);
extern void extract_venue(char*, char*, char*);

View File

@ -204,15 +204,12 @@ protected:
int compression;
public:
FILE* f;
ZFILE(string tag_, int comp)
: tag(tag_), compression(comp), f(0)
{printf("zfile const comp %d\n", compression);}
ZFILE(string tag_, int comp): tag(tag_), compression(comp), f(0) {}
~ZFILE() { close(); }
void open(const char* filename) {
close();
printf("opening %s\n", filename);
f = fopen(filename, "w");
if (!f) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "db_dump: Couldn't open %s for output\n", filename);
@ -234,16 +231,13 @@ public:
if (f) {
fprintf(f, "</%s>\n", tag.c_str());
fclose(f);
printf("close compression: %d\n", compression);
switch(compression) {
case COMPRESSION_ZIP:
sprintf(buf, "zip -q %s", current_path);
printf("system: %s\n", buf);
system(buf);
break;
case COMPRESSION_GZIP:
sprintf(buf, "gzip -fq %s", current_path);
printf("system: %s\n", buf);
system(buf);
break;
}
@ -278,6 +272,7 @@ void NUMBERED_ZFILE::set_id(int id) {
}
}
#if 0
void string_replace(string& str, string& old, string& newstr) {
string::size_type oldlen = old.size();
string::size_type newlen = newstr.size();
@ -309,8 +304,11 @@ void xml_escape(char* in, string& out) {
string_replace(out, x4, y4);
string_replace(out, x5, y5);
}
#endif
void write_host(HOST& host, FILE* f, bool detail) {
int retval;
fprintf(f,
"<host>\n"
" <id>%d</id>\n",
@ -318,7 +316,11 @@ void write_host(HOST& host, FILE* f, bool detail) {
);
if (detail) {
DB_USER user;
user.lookup_id(host.userid);
retval = user.lookup_id(host.userid);
if (retval) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "user lookup: %d\n", retval);
exit(1);
}
if (user.show_hosts) {
fprintf(f,
" <userid>%d</userid>\n",
@ -444,8 +446,9 @@ void write_user(USER& user, FILE* f, bool detail) {
void write_team(TEAM& team, FILE* f, bool detail) {
DB_USER user;
char buf[256];
string name;
string url, name_html, description;
xml_escape(team.name, name);
fprintf(f,
@ -463,39 +466,37 @@ void write_team(TEAM& team, FILE* f, bool detail) {
team.expavg_time,
team.nusers
);
fprintf(f,
" <create_time>%d</create_time>\n",
team.create_time
);
if (strlen(team.url)) {
xml_escape(team.url, url);
fprintf(f,
" <url>%s</url>\n",
url.c_str()
);
}
if (strlen(team.name_html)) {
xml_escape(team.name_html, name_html);
fprintf(f,
"<name_html>%s</name_html>\n",
name_html.c_str()
);
}
if (strlen(team.description)) {
xml_escape(team.description, description);
fprintf(f,
"<description>%s</description>\n",
description.c_str()
);
}
fprintf(f,
" <country>%s</country>\n",
team.country
);
if (detail) {
string url, name_html, description;
fprintf(f,
" <create_time>%d</create_time>\n",
team.create_time
);
if (strlen(team.url)) {
xml_escape(team.url, url);
fprintf(f,
" <url>%s</url>\n",
url.c_str()
);
}
if (strlen(team.name_html)) {
xml_escape(team.name_html, name_html);
fprintf(f,
"<name_html>%s</name_html>\n",
name_html.c_str()
);
}
if (strlen(team.description)) {
xml_escape(team.description, description);
fprintf(f,
"<description>%s</description>\n",
description.c_str()
);
}
fprintf(f,
" <country>%s</country>\n",
team.country
);
sprintf(buf, "where teamid=%d", team.id);
while (!user.enumerate(buf)) {
write_user(user, f, false);
@ -635,7 +636,6 @@ int ENUMERATION::make_it_happen(char* output_dir) {
for (i=0; i<outputs.size(); i++) {
OUTPUT& out = outputs[i];
printf("out comp %d\n", out.compression);
if (out.recs_per_file) {
out.nzfile = new NUMBERED_ZFILE(
tag_name[table], out.compression, path, out.recs_per_file
@ -647,19 +647,19 @@ int ENUMERATION::make_it_happen(char* output_dir) {
}
switch(sort) {
case SORT_ID:
strcpy(clause, "order by id");
strcpy(clause, "where total_credit > 0 order by id");
break;
case SORT_TOTAL_CREDIT:
strcpy(clause, "order by total_credit desc");
strcpy(clause, "where total_credit > 0 order by total_credit desc");
break;
case SORT_EXPAVG_CREDIT:
strcpy(clause, "order by expavg_credit desc");
strcpy(clause, "where total_credit > 0 order by expavg_credit desc");
break;
}
switch(table) {
case TABLE_USER:
n = 0;
while(!user.enumerate(clause)) {
while (!user.enumerate(clause)) {
for (i=0; i<outputs.size(); i++) {
OUTPUT& out = outputs[i];
if (sort == SORT_ID && out.recs_per_file) {
@ -723,6 +723,7 @@ int main(int argc, char** argv) {
check_stop_daemons();
setbuf(stderr, 0);
log_messages.printf(SCHED_MSG_LOG::NORMAL, "db_dump starting\n");
strcpy(spec_filename, "");
for (i=1; i<argc; i++) {
if (!strcmp(argv[i], "-dump_spec")) {
@ -783,4 +784,5 @@ int main(int argc, char** argv) {
spec.final_output_dir, spec.output_dir, spec.final_output_dir
);
system(buf);
log_messages.printf(SCHED_MSG_LOG::NORMAL, "db_dump finished\n");
}

View File

@ -829,11 +829,13 @@ void process_request(
}
// if there's no work, and client isn't returning results,
// this isn't an initial RPC,
// and client is requesting work, return without accessing DB
//
if ((sreq.work_req_seconds > 0)
&& ss.no_work()
&& (sreq.results.size() == 0)
&& (sreq.hostid != 0)
) {
strcat(reply.message, "No work available");
strcpy(reply.message_priority, "low");

View File

@ -66,6 +66,9 @@ int SCHED_CONFIG::parse(char* buf) {
if (match_tag(buf, "<ignore_upload_certificates/>")) {
ignore_upload_certificates = true;
}
if (match_tag(buf, "<enforce_delay_bound/>")) {
enforce_delay_bound = true;
}
parse_int(buf, "<min_sendwork_interval>", min_sendwork_interval);
parse_int(buf, "<max_wus_to_send>", max_wus_to_send);
parse_int(buf, "<daily_result_quota>", daily_result_quota);

View File

@ -42,6 +42,7 @@ public:
bool non_cpu_intensive;
bool homogeneous_redundancy;
bool ignore_upload_certificates;
bool enforce_delay_bound;
int daily_result_quota; // max results per host per day
int parse(char*);

View File

@ -167,16 +167,18 @@ bool wu_is_feasible(
return false;
}
double wu_wallclock_time = estimate_wallclock_duration(wu, host, resource_share_fraction);
int host_remaining_time = 0; // TODO
if (config.enforce_delay_bound) {
double wu_wallclock_time = estimate_wallclock_duration(wu, host, resource_share_fraction);
int host_remaining_time = 0; // TODO
if (host_remaining_time + wu_wallclock_time > wu.delay_bound) {
log_messages.printf(
SCHED_MSG_LOG::DEBUG, "[WU#%d %s] needs requires %d seconds on [HOST#%d]; delay_bound is %d\n",
wu.id, wu.name, (int)wu_wallclock_time, host.id, wu.delay_bound
);
wreq.insufficient_speed = true;
return false;
if (host_remaining_time + wu_wallclock_time > wu.delay_bound) {
log_messages.printf(
SCHED_MSG_LOG::DEBUG, "[WU#%d %s] needs requires %d seconds on [HOST#%d]; delay_bound is %d\n",
wu.id, wu.name, (int)wu_wallclock_time, host.id, wu.delay_bound
);
wreq.insufficient_speed = true;
return false;
}
}
return true;