From 7542bd66c9c353353fce0cca8dba1e837b4a9476 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 11 Dec 2003 19:05:52 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2780 --- checkin_notes | 46 +++++++++++++++++++++++++++++++++++++++++- db/boinc_db.C | 17 ++++++++++++---- db/boinc_db.h | 6 ++++++ db/db_base.C | 16 +-------------- db/db_base.h | 2 +- db/schema.sql | 3 +++ html/ops/db_ops.inc | 1 + html/user/download.inc | 1 + html/user/host.inc | 2 +- html/user/index.php | 1 + html/user/stats.php | 11 ++++++---- html/user/util.inc | 2 +- py/Boinc/database.py | 10 ++------- sched/assimilator.C | 2 +- sched/db_dump.C | 4 ++-- sched/feeder.C | 2 +- sched/file_deleter.C | 2 +- sched/main.C | 2 +- sched/make_work.C | 2 +- sched/sched_config.C | 1 + sched/sched_config.h | 1 + sched/sched_shmem.C | 1 + sched/transitioner.C | 14 ++++++++++--- sched/update_stats.C | 2 +- sched/validate.C | 2 +- sched/wu_check.C | 2 +- 26 files changed, 107 insertions(+), 48 deletions(-) diff --git a/checkin_notes b/checkin_notes index 87bde4f8c0..40a2516a3b 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8355,5 +8355,49 @@ Eric K. 12/11/2003 m4/sah_namespace.m4 m4/sah_header_stdcxx.m4 +David 11 Dec 1003 + - Add 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 diff --git a/db/boinc_db.C b/db/boinc_db.C index cf433c0b2d..56c04c5ad5 100644 --- a/db/boinc_db.C +++ b/db/boinc_db.C @@ -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){ diff --git a/db/boinc_db.h b/db/boinc_db.h index e2a5041188..5e9b31d5f3 100755 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -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; diff --git a/db/db_base.C b/db/db_base.C index 9547de7f9f..3fab003d7c 100644 --- a/db/db_base.C +++ b/db/db_base.C @@ -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); diff --git a/db/db_base.h b/db/db_base.h index c11f4420eb..4780ba2b8d 100644 --- a/db/db_base.h +++ b/db/db_base.h @@ -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*); diff --git a/db/schema.sql b/db/schema.sql index 66299aa0ea..650e90bec3 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -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) ); diff --git a/html/ops/db_ops.inc b/html/ops/db_ops.inc index cd67582c90..02dc754c71 100644 --- a/html/ops/db_ops.inc +++ b/html/ops/db_ops.inc @@ -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"; } diff --git a/html/user/download.inc b/html/user/download.inc index e5152baab1..4261106ace 100644 --- a/html/user/download.inc +++ b/html/user/download.inc @@ -31,6 +31,7 @@ function print_download_links() { echo "Computer typeVersionRelease Date\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); diff --git a/html/user/host.inc b/html/user/host.inc index 0401099c08..4c77562f20 100644 --- a/html/user/host.inc +++ b/html/user/host.inc @@ -119,7 +119,7 @@ function host_table_start($title, $private) { Total credit CPU type Operating system - Results (Valid / Successful / Total) [Last Received] + Results "; } diff --git a/html/user/index.php b/html/user/index.php index 55b60aea1c..693c99825b 100644 --- a/html/user/index.php +++ b/html/user/index.php @@ -31,6 +31,7 @@ if (project_is_stopped()) {

Returning participants

diff --git a/html/user/stats.php b/html/user/stats.php index 30709339fd..bf6b12d66f 100644 --- a/html/user/stats.php +++ b/html/user/stats.php @@ -7,9 +7,9 @@ page_head('Project statistics'); echo "

Project statistics

-Leader boards (information about work done, -both in total and broken down by user, team, and computer) -is not directly available on this web site. +Leader boards (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 here, @@ -18,8 +18,11 @@ and the files are

This data can be summarized and represented as Web pages. -An example (in Danish) is at +An example (implemented using PHP) is at http://www.boinc.dk. +If you are interested in using or contributing to this code, +please contact the developer, +Janus Kristensen. "; page_tail(); diff --git a/html/user/util.inc b/html/user/util.inc index 7fe8f01c18..a71ab6477b 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -180,7 +180,7 @@ function time_str($x) { function pretty_time_str($x) { if ($x == 0) return " "; - 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="") { diff --git a/py/Boinc/database.py b/py/Boinc/database.py index c03b4351ad..cf5472a1e2 100644 --- a/py/Boinc/database.py +++ b/py/Boinc/database.py @@ -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( diff --git a/sched/assimilator.C b/sched/assimilator.C index 8a4889dd0a..fe727035b1 100644 --- a/sched/assimilator.C +++ b/sched/assimilator.C @@ -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); diff --git a/sched/db_dump.C b/sched/db_dump.C index da4eba9342..ddd7118842 100644 --- a/sched/db_dump.C +++ b/sched/db_dump.C @@ -476,7 +476,7 @@ int print_app(FILE* f, APP& app) { int n, retval; fprintf(f, " \n"); - fprintf(f, " %s\n", app.name); + fprintf(f, " %s\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); diff --git a/sched/feeder.C b/sched/feeder.C index da5e153b70..a5bd1a61fc 100644 --- a/sched/feeder.C +++ b/sched/feeder.C @@ -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); diff --git a/sched/file_deleter.C b/sched/file_deleter.C index 0571e3ffd1..1d0138cd36 100644 --- a/sched/file_deleter.C +++ b/sched/file_deleter.C @@ -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); diff --git a/sched/main.C b/sched/main.C index 35445f8915..6236971bfd 100644 --- a/sched/main.C +++ b/sched/main.C @@ -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; diff --git a/sched/make_work.C b/sched/make_work.C index 211cfba845..e066f12e45 100644 --- a/sched/make_work.C +++ b/sched/make_work.C @@ -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); diff --git a/sched/sched_config.C b/sched/sched_config.C index a701b35f12..5cf2a8b531 100644 --- a/sched/sched_config.C +++ b/sched/sched_config.C @@ -48,6 +48,7 @@ int SCHED_CONFIG::parse(istream& f) { memset(this, 0, sizeof(SCHED_CONFIG)); parse_str(buf.c_str(), "", db_name, sizeof(db_name)); parse_str(buf.c_str(), "", db_passwd, sizeof(db_passwd)); + parse_str(buf.c_str(), "", db_host, sizeof(db_host)); parse_int(buf.c_str(), "", shmem_key); parse_str(buf.c_str(), "", key_dir, sizeof(key_dir)); parse_str(buf.c_str(), "", download_url, sizeof(download_url)); diff --git a/sched/sched_config.h b/sched/sched_config.h index fa78411328..d198d60c5d 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -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]; diff --git a/sched/sched_shmem.C b/sched/sched_shmem.C index 843f50f73d..169863d81b 100644 --- a/sched/sched_shmem.C +++ b/sched/sched_shmem.C @@ -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"); } diff --git a/sched/transitioner.C b/sched/transitioner.C index cbc3e71e41..4b285ae281 100644 --- a/sched/transitioner.C +++ b/sched/transitioner.C @@ -184,6 +184,7 @@ void handle_wu(DB_WORKUNIT& wu) { if (wu.error_mask) { for (unsigned int i=0; iREADY\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); diff --git a/sched/update_stats.C b/sched/update_stats.C index fc1305a8c9..c6b2a6743f 100644 --- a/sched/update_stats.C +++ b/sched/update_stats.C @@ -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); diff --git a/sched/validate.C b/sched/validate.C index 0fcd485a74..a13e15552c 100644 --- a/sched/validate.C +++ b/sched/validate.C @@ -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); diff --git a/sched/wu_check.C b/sched/wu_check.C index 8e4060ab91..5a8476e397 100644 --- a/sched/wu_check.C +++ b/sched/wu_check.C @@ -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);