*** empty log message ***

svn path=/trunk/boinc/; revision=2780
This commit is contained in:
David Anderson 2003-12-11 19:05:52 +00:00
parent d13efa35a2
commit 7542bd66c9
26 changed files with 107 additions and 48 deletions

View File

@ -8355,5 +8355,49 @@ Eric K. 12/11/2003
m4/sah_namespace.m4
m4/sah_header_stdcxx.m4
David 11 Dec 1003
- Add <db_host> element to config file and SCHED_CONFIG.
Add db_host argument to DB_CONN::open()
All server programs can now be run on different machine from MySQL
- Add "deprecated" field to app table
Deprecated apps are treated as non-existent
- Add "deprecated", "user_friendly_name" to platform table
Deprecated platforms are treated as non-existent
- Add new value for validate_state: VALIDATE_STATE_NO_CHECK
This indicates the the result's WU had an error,
and the result will never be validated.
Such results are not counted towards pending credit.
Transitioner: when set a WU error flag,
change its results VALIDATE_STATE_INIT -> NO_CHECK
_ Add "Applications" page to web site:
shows platforms, latest version for each app
db/
boinc_db.C,h
db_base.C,h
schema.sql
html_ops/
db_ops.inc
html_user/
download.inc
host.inc
index.php
stats.php
util.inc
apps.php (new)
intro.php (new)
py/Boinc
database.py
sched/
assimilator.C
db_dump.C
feeder.C
file_deleter.C
main.C
make_work.C
sched_config.C,h
sched_shmem.C
transitioner.C
update_stats.C
validate.C
wu_check.C

View File

@ -17,6 +17,9 @@
// Contributor(s):
//
// $Log$
// Revision 1.25 2003/12/11 19:05:48 boincadm
// *** empty log message ***
//
// Revision 1.24 2003/12/11 18:38:05 korpela
// Added include of "std_fixes.h"
//
@ -102,8 +105,9 @@ void DB_PROJECT::db_parse(MYSQL_ROW &r) {
void DB_PLATFORM::db_print(char* buf){
sprintf(buf,
"id=%d, create_time=%d, name='%s', user_friendly_name='%s'",
id, create_time, name, user_friendly_name
"id=%d, create_time=%d, name='%s', user_friendly_name='%s', "
"deprecated=%d",
id, create_time, name, user_friendly_name, deprecated
);
}
@ -114,6 +118,7 @@ void DB_PLATFORM::db_parse(MYSQL_ROW &r) {
create_time=atol(r[i++]);
strcpy2(name, r[i++]);
strcpy2(user_friendly_name, r[i++]);
deprecated=atol(r[i++]);
}
void DB_CORE_VERSION::db_print(char* buf) {
@ -139,8 +144,10 @@ void DB_CORE_VERSION::db_parse(MYSQL_ROW &r) {
void DB_APP::db_print(char* buf){
sprintf(buf,
"id=%d, create_time=%d, name='%s', min_version=%d ",
id, create_time, name, min_version
"id=%d, create_time=%d, name='%s', min_version=%d, "
"deprecated=%d, user_friendly_name='%s'",
id, create_time, name, min_version,
deprecated, user_friendly_name
);
}
@ -151,6 +158,8 @@ void DB_APP::db_parse(MYSQL_ROW &r) {
create_time = atoi(r[i++]);
strcpy2(name, r[i++]);
min_version = atoi(r[i++]);
deprecated = atoi(r[i++]);
strcpy2(user_friendly_name, r[i++]);
}
void DB_APP_VERSION::db_print(char* buf){

View File

@ -63,6 +63,7 @@ struct PLATFORM {
int create_time;
char name[256]; // i.e. "sparc-sun-solaris"
char user_friendly_name[256]; // i.e. "SPARC Solaris 2.8"
int deprecated;
void clear();
};
@ -89,6 +90,8 @@ struct APP {
int create_time;
char name[256]; // application name, preferably short
int min_version; // don't use app versions before this
int deprecated;
char user_friendly_name[256];
int write(FILE*);
void clear();
};
@ -366,6 +369,9 @@ struct WORKUNIT {
#define VALIDATE_STATE_INIT 0
#define VALIDATE_STATE_VALID 1
#define VALIDATE_STATE_INVALID 2
#define VALIDATE_STATE_NO_CHECK 3
// WU had error, so we'll never get around to validating its results
// This lets us avoid showing the claimed credit as "pending"
struct RESULT {
int id;

View File

@ -11,21 +11,7 @@ DB_CONN::DB_CONN() {
mysql = 0;
}
int DB_CONN::open(char* dbname, char* dbpassword) {
char buf[256],*db_name,*db_host,*p;
if (dbname) {
strncpy(buf,dbname,254);
buf[255]=0;
db_name=buf;
} else {
db_name=0;
}
if ((p=strchr(buf,'@'))) {
db_host=p+1;
*p=0;
} else {
db_host=0;
}
int DB_CONN::open(char* db_name, char* db_host, char* dbpassword) {
mysql = mysql_init(0);
if (!mysql) return 0;
mysql = mysql_real_connect(mysql, db_host, 0, dbpassword, db_name, 0, 0, 0);

View File

@ -32,7 +32,7 @@ struct CURSOR {
class DB_CONN {
public:
DB_CONN();
int open(char* name, char* passwd);
int open(char* name, char* host, char* passwd);
void close();
int insert_id();
void print_error(char*);

View File

@ -21,6 +21,7 @@ create table platform (
create_time integer not null,
name varchar(254) not null,
user_friendly_name varchar(254) not null,
deprecated integer not null,
primary key (id)
);
@ -40,6 +41,8 @@ create table app (
create_time integer not null,
name varchar(254) not null,
min_version integer not null,
deprecated integer not null,
user_friendly_name varchar(254) not null,
primary key (id)
);

View File

@ -593,6 +593,7 @@ function validate_state_str($s) {
case 0: return "Initial";
case 1: return "Valid";
case 2: return "Invalid";
case 3: return "Skipped";
}
return "Unknown";
}

View File

@ -31,6 +31,7 @@ function print_download_links() {
echo "<tr><th>Computer type</th><th>Version</th><th>Release Date</th></tr>\n";
$result = mysql_query("select * from platform order by name");
while ($platform = mysql_fetch_object($result)) {
if ($platform->deprecated) continue;
platform_downloads($platform);
}
mysql_free_result($result);

View File

@ -119,7 +119,7 @@ function host_table_start($title, $private) {
<th><a href=top_hosts.php?sort_by=total_credit>Total credit</a></th>
<th>CPU type</th>
<th>Operating system</th>
<th>Results (Valid / Successful / Total) [Last Received]</th>
<th>Results</th>
</tr>
";
}

View File

@ -31,6 +31,7 @@ if (project_is_stopped()) {
<ul>
<li><a href=".URL_BASE."info.php>Rules and policies <b>[read this first]</b></a>
<li><a href=".URL_BASE."create_account_form.php>Create account</a>
<li><a href=apps.php>Applications</a>
</ul>
<h3>Returning participants</h3>

View File

@ -7,9 +7,9 @@ page_head('Project statistics');
echo "
<h2>Project statistics</h2>
<p>
<b>Leader boards</b> (information about work done,
both in total and broken down by user, team, and computer)
is not directly available on this web site.
<b>Leader boards</b> (showing which
users, teams, and computers have done the most work)
are not directly available on this web site.
Instead, the raw data is available as compressed XML files.
The format is described
<a href=http://boinc.berkeley.edu/db_dump.php>here</a>,
@ -18,8 +18,11 @@ and the files are
<p>
This data can be summarized and represented as Web pages.
An example (in Danish) is at
An example (implemented using PHP) is at
<a href=http://www.boinc.dk/index.php?page=statistics>http://www.boinc.dk</a>.
If you are interested in using or contributing to this code,
please contact the developer,
<a href=mailto:stats@boinc.dk>Janus Kristensen</a>.
";
page_tail();

View File

@ -180,7 +180,7 @@ function time_str($x) {
function pretty_time_str($x) {
if ($x == 0) return "&nbsp;";
return gmdate('D j M Y g:i a', $x) . " UTC";
return gmdate('j M Y g:i a', $x) . " UTC";
}
function start_table($extra="") {

View File

@ -45,14 +45,8 @@ class Platform(DatabaseObject):
table = 'platform',
columns = [ 'create_time',
'name',
'user_friendly_name' ])
class Platform(DatabaseObject):
_table = DatabaseTable(
table = 'platform',
columns = [ 'create_time',
'name',
'user_friendly_name' ])
'user_friendly_name',
'deprecated' ])
class CoreVersion(DatabaseObject):
_table = DatabaseTable(

View File

@ -114,7 +114,7 @@ int main(int argc, char** argv) {
// write_pid_file(PIDFILE);
log_messages.printf(SchedMessages::NORMAL, "Starting\n");
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "Can't open DB\n");
exit(1);

View File

@ -476,7 +476,7 @@ int print_app(FILE* f, APP& app) {
int n, retval;
fprintf(f, " <application>\n");
fprintf(f, " <name>%s</name>\n", app.name);
fprintf(f, " <name>%s</name>\n", app.user_friendly_name);
sprintf(buf, "where appid=%d and server_state=%d", app.id, RESULT_SERVER_STATE_UNSENT);
retval = result.count(n, buf);
@ -592,7 +592,7 @@ int main(int argc, char** argv) {
log_messages.printf(SchedMessages::NORMAL, "Can't parse config file\n");
exit(1);
}
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::NORMAL, "Can't open DB\n");
exit(1);

View File

@ -377,7 +377,7 @@ int main(int argc, char** argv) {
atexit(cleanup_shmem);
install_sigint_handler();
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d\n", retval);
exit(1);

View File

@ -168,7 +168,7 @@ int main(int argc, char** argv) {
// write_pid_file(PIDFILE);
log_messages.printf(SchedMessages::NORMAL, "Starting\n");
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "can't open DB\n");
exit(1);

View File

@ -131,7 +131,7 @@ int main() {
}
}
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "can't open database\n");
project_stopped = true;

View File

@ -133,7 +133,7 @@ void make_work() {
exit(1);
}
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "can't open db\n");
exit(1);

View File

@ -48,6 +48,7 @@ int SCHED_CONFIG::parse(istream& f) {
memset(this, 0, sizeof(SCHED_CONFIG));
parse_str(buf.c_str(), "<db_name>", db_name, sizeof(db_name));
parse_str(buf.c_str(), "<db_passwd>", db_passwd, sizeof(db_passwd));
parse_str(buf.c_str(), "<db_host>", db_host, sizeof(db_host));
parse_int(buf.c_str(), "<shmem_key>", shmem_key);
parse_str(buf.c_str(), "<key_dir>", key_dir, sizeof(key_dir));
parse_str(buf.c_str(), "<download_url>", download_url, sizeof(download_url));

View File

@ -29,6 +29,7 @@ class SCHED_CONFIG {
public:
char db_name[256];
char db_passwd[256];
char db_host[256];
int shmem_key;
char key_dir[256];
char download_url[256];

View File

@ -75,6 +75,7 @@ int SCHED_SHMEM::scan_tables() {
n = 0;
while (!platform.enumerate()) {
if (platform.deprecated) continue;
platforms[n++] = platform;
if (n == MAX_PLATFORMS) overflow("platforms");
}

View File

@ -184,6 +184,7 @@ void handle_wu(DB_WORKUNIT& wu) {
if (wu.error_mask) {
for (unsigned int i=0; i<results.size(); i++) {
DB_RESULT& result = results[i];
bool update_result = false;
if (result.server_state == RESULT_SERVER_STATE_UNSENT) {
log_messages.printf(
SchedMessages::NORMAL,
@ -192,13 +193,20 @@ void handle_wu(DB_WORKUNIT& wu) {
);
result.server_state = RESULT_SERVER_STATE_OVER;
result.outcome = RESULT_OUTCOME_DIDNT_NEED;
update_result = true;
}
if (result.validate_state == VALIDATE_STATE_INIT) {
result.validate_state = VALIDATE_STATE_NO_CHECK;
update_result = true;
}
if (update_result) {
retval = result.update();
if (retval) {
log_messages.printf(
SchedMessages::CRITICAL,
"[WU#%d %s] [RESULT#%d %s] result.update() == %d\n",
wu.id, wu.name, result.id, result.name, retval
);
);
}
}
}
@ -208,7 +216,7 @@ void handle_wu(DB_WORKUNIT& wu) {
SchedMessages::NORMAL,
"[WU#%d %s] error_mask:%d assimilate_state:INIT=>READY\n",
wu.id, wu.name, wu.error_mask
);
);
}
} else if (wu.assimilate_state == ASSIMILATE_INIT) {
// If no error, generate new results if needed.
@ -348,7 +356,7 @@ bool do_pass() {
void main_loop(bool one_pass) {
int retval;
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d\n", retval);
exit(1);

View File

@ -160,7 +160,7 @@ int main(int argc, char** argv) {
log_messages.printf(SchedMessages::CRITICAL, "Can't parse config file\n");
exit(1);
}
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "Can't open DB\n");
exit(1);

View File

@ -326,7 +326,7 @@ int main_loop(bool one_pass) {
bool did_something;
char buf[256];
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
log_messages.printf(SchedMessages::CRITICAL, "boinc_db.open: %d\n", retval);
exit(1);

View File

@ -88,7 +88,7 @@ int main(int argc, char** argv) {
retval = config.parse_file();
if (retval) exit(1);
retval = boinc_db.open(config.db_name, config.db_passwd);
retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd);
if (retval) {
printf("boinc_db.open: %d\n", retval);
exit(1);