From a26d8c4d1a1833eaa47ad6414bf3d27367d28cbc Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 6 Mar 2003 17:42:49 +0000 Subject: [PATCH] various svn path=/trunk/boinc/; revision=1021 --- checkin_notes | 41 ++++++++++ client/client_state.C | 14 ++-- client/cs_scheduler.C | 3 +- client/main.C | 12 +-- client/message.h | 15 +++- client/scheduler_op.C | 2 +- doc/prefs.html | 25 ++++-- html/user/add_venue_form.php | 6 +- html/user/bug_report_form.php | 27 +++---- html/user/create_account_action.php | 22 +++--- html/user/create_account_form.php | 91 +++++++--------------- html/user/db.inc | 5 +- html/user/edit_email_form.php | 18 +++-- html/user/edit_user_info_form.php | 28 ++++--- html/user/index.php | 3 + html/user/login_action.php | 11 --- html/user/login_form.php | 12 ++- html/user/prefs.inc | 17 ++-- html/user/prefs_edit_form.php | 2 +- html/user/show_user.php | 3 + html/user/team_create_form.php | 115 ++++++++++++---------------- html/user/top_hosts.php | 1 + html/user/user.inc | 33 +++----- html/user/util.inc | 48 ++++++------ lib/parse.C | 2 - lib/parse.h | 2 - lib/util.C | 7 ++ lib/util.h | 1 + sched/assimilator.C | 5 +- sched/feeder.C | 5 +- sched/file_deleter.C | 5 +- sched/file_upload_handler.C | 6 +- sched/main.C | 6 +- sched/make_work.C | 5 +- sched/result_retry.C | 5 +- sched/validate.C | 5 +- 36 files changed, 293 insertions(+), 315 deletions(-) diff --git a/checkin_notes b/checkin_notes index 44aa48a3bf..69da77f3cd 100755 --- a/checkin_notes +++ b/checkin_notes @@ -3691,3 +3691,44 @@ David Mar 5 2003 sched/ Makefile.in server_types.C + +David Mar 6 2003 + - new show_message() conventions (not fully implemented): + - all error conditions should call show_message() with MSG_ERROR + - all log writes should use show_message() with MSG_INFO + TODO: change Win implementation of show_message() to + write to window AND to file (stderr.txt or stdout.txt) + - messages are now timestamped and show project name + - use start_table() and row2() more uniformly in user HTML + - user HTML: show message if can't connect to DB + - standardize terminology in user HTML: "general prefs", + "default computer location", etc. + + client/ + client_state.C + cs_scheduler.C + main.C + message.h + scheduler_op.C + doc/ + prefs.html + html_user/ + add_venue_form.php + bug_report_form.php + create_account*.php + db.inc + edit_email_form.php + edit_user_info_form.php + index.php + login*.php + prefs.inc + prefs_edit_form.php + show_user.php + team_create_form.php + top_hosts.php + user.inc + util.inc + lib/ + util.C,h + sched/ + *.C diff --git a/client/client_state.C b/client/client_state.C index 741deb5ee0..c16b5ef01a 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -140,7 +140,7 @@ int CLIENT_STATE::init() { // retval = global_prefs.parse_file(host_venue); if (retval) { - printf("No global preferences file; will use defaults.\n"); + printf("Using default preferences.\n"); } install_global_prefs(); @@ -152,7 +152,7 @@ int CLIENT_STATE::init() { // if (gstate.should_run_time_tests()) { time_tests_start = time(0); - show_message(NULL, "Running time tests", "low"); + show_message(NULL, "Running CPU benchmarks", MSG_INFO); #ifdef _WIN32 time_tests_handle = CreateThread( NULL, 0, win_time_tests, NULL, 0, &time_tests_id @@ -279,7 +279,7 @@ int CLIENT_STATE::check_time_tests() { GetExitCodeThread(time_tests_handle, &exit_code); if(exit_code == STILL_ACTIVE) { if(time(NULL) > time_tests_start + MAX_TIME_TESTS_SECONDS) { - show_message(NULL, "Time tests timed out, using default values", "low"); + show_message(NULL, "CPU benchmarks timed out, using default values", MSG_ERROR); TerminateThread(time_tests_handle, 0); CloseHandle(time_tests_handle); host_info.p_fpops = 1e9; @@ -297,7 +297,7 @@ int CLIENT_STATE::check_time_tests() { retval = waitpid(time_tests_id, &exit_code, WNOHANG); if(retval == 0) { if((unsigned int)time(NULL) > time_tests_start + MAX_TIME_TESTS_SECONDS) { - show_message(NULL, "Time tests timed out, using default values", "low"); + show_message(NULL, "CPU benchmarks timed out, using default values", MSG_ERROR); kill(time_tests_id, SIGKILL); host_info.p_fpops = 1e9; host_info.p_iops = 1e9; @@ -310,10 +310,10 @@ int CLIENT_STATE::check_time_tests() { } #endif time_tests_id = 0; - show_message(NULL, "Time tests complete", "low"); + show_message(NULL, "CPU benchmarks complete", MSG_INFO); finfo = fopen(TIME_TESTS_FILE_NAME, "r"); - if(!finfo) { - show_message(NULL, "Error in time tests file, using default values", "low"); + if (!finfo) { + show_message(NULL, "Can't open CPU benchmark file, using default values", MSG_ERROR); host_info.p_fpops = 1e9; host_info.p_iops = 1e9; host_info.p_membw = 4e9; diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index d9f096dde9..73834dadcd 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -350,7 +350,8 @@ int CLIENT_STATE::handle_scheduler_reply( project->user_expavg_credit = sr.user_expavg_credit; project->user_create_time = sr.user_create_time; if (strlen(sr.message)) { - show_message(project, sr.message, sr.message_priority); + int prio = (!strcmp(sr.message_priority, "high"))?MSG_ERROR:MSG_INFO; + show_message(project, sr.message, prio); } if (sr.request_delay) { diff --git a/client/main.C b/client/main.C index d068f91acf..31bfde50a5 100644 --- a/client/main.C +++ b/client/main.C @@ -38,11 +38,13 @@ // Display a message to the user. // Depending on the priority, the message may be more or less obtrusive // -void show_message(PROJECT *p, char* message, char* priority) { - if (!strcmp(priority, "high")) { - fprintf(stderr, "BOINC core client: %s (priority: %s)\n", message, priority); - } else { - printf("BOINC core client: %s (priority: %s)\n", message, priority); +void show_message(PROJECT *p, char* message, int priority) { + const char* proj = p?p->project_name:"BOINC"; + switch (priority) { + case MSG_ERROR: + fprintf(stderr, "%s [%s] %s", timestamp(), proj, message); + default: + printf("%s [%s] %s", timestamp(), proj, message); } } diff --git a/client/message.h b/client/message.h index c0f83d4287..6449ce5242 100644 --- a/client/message.h +++ b/client/message.h @@ -1,4 +1,11 @@ -// show a message. -// Implemented in different ways in cmdline client versus GUI client -// -extern void show_message(PROJECT *p, char* message, char* priority); +// Show a message, preceded by timestamp and project name +// priorities: + +#define MSG_INFO 1 + // cmdline: write to stdout + // GUI: write to msg window +#define MSG_ERROR 2 + // cmdline: write to stderr + // GUI: write to msg window in bold or red + +extern void show_message(PROJECT *p, char* message, int priority); diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 5ac1b98f76..8ccbc3e19b 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -351,7 +351,7 @@ bool SCHEDULER_OP::poll() { "Could not contact %s. Make sure this is the correct project URL.", err_url ); - show_message(project, err_msg, "high"); + show_message(project, err_msg, MSG_ERROR); project->master_fetch_failures++; backoff(project, err_msg); } diff --git a/doc/prefs.html b/doc/prefs.html index 13614db281..5902eaacda 100644 --- a/doc/prefs.html +++ b/doc/prefs.html @@ -5,8 +5,8 @@ You can specify preferences determining and limiting how BOINC uses your computers. Preferences are divided into two groups: -

Global preferences

-Global preferences apply to all projects in which you participate. +

General preferences

+General preferences apply to all BOINC projects in which you participate. They include: +

Leader boards

+