From f4d30aa220ee8ff24847e585c6d42f0a8bdd00ca Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 31 Dec 2003 23:09:21 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2840 --- checkin_notes | 35 +++++++++++++++++++++++++++++++++++ db/constraints.sql | 8 ++++---- db/schema.sql | 2 +- html/ops/db_ops.inc | 2 +- html/user/project.inc.sample | 4 ++++ html/user/util.inc | 14 ++++---------- py/Boinc/setup_project.py | 3 ++- sched/assimilator.C | 6 ++++-- sched/feeder.C | 2 +- sched/file_deleter.C | 2 +- sched/handle_request.C | 22 +++++++++++++--------- sched/make_work.C | 2 +- sched/sched_config.C | 1 + sched/sched_config.h | 1 + sched/sched_util.C | 19 +++++++++++-------- sched/sched_util.h | 4 ++-- sched/transitioner.C | 2 +- sched/validate.C | 2 +- test/testbase.py | 3 ++- 19 files changed, 90 insertions(+), 44 deletions(-) diff --git a/checkin_notes b/checkin_notes index cd94013e5f..9b04882259 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8805,3 +8805,38 @@ David 30 Dec 2003 client/ client_types.C,h + +David 31 Dec 2003 + - Made the basic test script (test_uc.py) work again: + - fixed syntax errors in SQL files + - initial config.xml file includes element + - back-end processes handle SIGHUP, not SIGINT + (we changed in "start"; need to change here too) + - "MIN_SENDWORK_INTERVAL" is read from config.xml (default 0) + - added 12-second sleep in run_check_all() + (based on 10-sec sleep in assimilator; should reduce) + - The user and admin web interfaces now work in the basic test case + (i.e. you can use html_ops to look at DB contents) + + db/ + constraints.sql + schema.sql + html_ops/ + db_ops.inc + html_user/ + project.inc.sample + util.inc + py/Boinc/ + setup_project.py + sched/ + assimilator.C + feeder.C + file_deleter.C + handle_request.C + make_work.C + sched_config.C,h + sched_util.C,h + transitioner.C + validate.C + test/ + testbase.py diff --git a/db/constraints.sql b/db/constraints.sql index af5c16e096..a3dbcb655c 100644 --- a/db/constraints.sql +++ b/db/constraints.sql @@ -49,9 +49,9 @@ alter table result add unique(name), -- the scheduler looks up results by name - //add index res_wuid (workunitid), - // -- transitioner - // -- NOTE: res_wu_user may suffice; could try dropping this one + add index res_wuid (workunitid), + -- transitioner + -- NOTE res_wu_user may suffice, could try dropping this one add index ind_res_st (server_state, random), -- feeder (random is to avoid sending WU result close together) @@ -86,7 +86,7 @@ alter table host -- db_dump.C alter table profile - add fulltext index profile_reponse(response1, reponse2), + add fulltext index profile_reponse(response1, response2), add unique profile_userid(userid); alter table subscriptions diff --git a/db/schema.sql b/db/schema.sql index fdba9728b7..7713c3aaf3 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -304,7 +304,7 @@ create table thread ( -- number of postings in thread activity double not null, -- for questions: number of askers / time since asked - (set periodically by update_forum_activity.php) + -- (set periodically by update_forum_activity.php) sufferers integer not null, -- in help desk: # people who indicated they had same problem create_time integer not null, diff --git a/html/ops/db_ops.inc b/html/ops/db_ops.inc index a55df6593c..285abd44f8 100644 --- a/html/ops/db_ops.inc +++ b/html/ops/db_ops.inc @@ -8,7 +8,7 @@ function db_init() { } $db_name = parse_config(""); if(!mysql_select_db($db_name)) { - echo "Unable to select database - please try again later"; + echo "Unable to select database '$db_name' - please try again later"; exit(); } diff --git a/html/user/project.inc.sample b/html/user/project.inc.sample index 137b73336a..7d3f101c58 100644 --- a/html/user/project.inc.sample +++ b/html/user/project.inc.sample @@ -64,4 +64,8 @@ Tell us your thoughts about " . PROJECT . "
    "); } +function project_news() { + echo "No news is good news\n"; +} + ?> diff --git a/html/user/util.inc b/html/user/util.inc index 70bd49205c..c5a6a6f87b 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -1,6 +1,6 @@ init(); atexit(cleanup_shmem); - install_sigint_handler(); + install_stop_signal_handler(); retval = boinc_db.open(config.db_name, config.db_host, config.db_passwd); if (retval) { diff --git a/sched/file_deleter.C b/sched/file_deleter.C index 1d0138cd36..a1b80948af 100644 --- a/sched/file_deleter.C +++ b/sched/file_deleter.C @@ -173,7 +173,7 @@ int main(int argc, char** argv) { log_messages.printf(SchedMessages::CRITICAL, "can't open DB\n"); exit(1); } - install_sigint_handler(); + install_stop_signal_handler(); if (one_pass) { do_pass(); } else { diff --git a/sched/handle_request.C b/sched/handle_request.C index 1d92e361ee..e961d0711f 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -44,7 +44,6 @@ using namespace std; const int MIN_SECONDS_TO_SEND = 0; const int MAX_SECONDS_TO_SEND = (28*SECONDS_PER_DAY); const int MAX_WUS_TO_SEND = 10; -const int MIN_SENDWORK_INTERVAL = 15*60; const double COBBLESTONE_FACTOR = 300.0; @@ -1032,15 +1031,20 @@ void process_request( handle_results(sreq, reply, reply.host); - // if last RPC was within MIN_SENDWORK_INTERVAL, don't send work + // if last RPC was within config.min_sendwork_interval, don't send work // - double diff = dtime() - last_rpc_time; - if (diff < MIN_SENDWORK_INTERVAL) { - log_messages.printf( - SchedMessages::NORMAL, - "Not sending work - last RPC too recent: %f\n", diff - ); - } else { + bool ok_to_send = true; + if (config.min_sendwork_interval) { + double diff = dtime() - last_rpc_time; + if (diff < config.min_sendwork_interval) { + ok_to_send = false; + log_messages.printf( + SchedMessages::NORMAL, + "Not sending work - last RPC too recent: %f\n", diff + ); + } + } + if (ok_to_send) { send_work(sreq, reply, *platform, ss); } diff --git a/sched/make_work.C b/sched/make_work.C index e066f12e45..ddc75886a8 100644 --- a/sched/make_work.C +++ b/sched/make_work.C @@ -298,7 +298,7 @@ int main(int argc, char** argv) { "Starting: min_quorum=%d target_nresults=%d max_error_results=%d max_total_results=%d max_success_results=%d\n", min_quorum, target_nresults, max_error_results, max_total_results, max_success_results ); - install_sigint_handler(); + install_stop_signal_handler(); srand48(getpid() + time(0)); make_work(); diff --git a/sched/sched_config.C b/sched/sched_config.C index 5cf2a8b531..962949f5f0 100644 --- a/sched/sched_config.C +++ b/sched/sched_config.C @@ -59,6 +59,7 @@ int SCHED_CONFIG::parse(istream& f) { if (match_tag(buf.c_str(), "")) { one_result_per_user_per_wu = true; } + parse_int(buf.c_str(), "", min_sendwork_interval); if (match_tag(buf.c_str(), "")) return 0; return ERR_XML_PARSE; } diff --git a/sched/sched_config.h b/sched/sched_config.h index d198d60c5d..ff77bcd952 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -38,6 +38,7 @@ public: char upload_dir[256]; char user_name[256]; bool one_result_per_user_per_wu; + int min_sendwork_interval; int parse(istream& f); int parse_file(char* dir="."); diff --git a/sched/sched_util.C b/sched/sched_util.C index 6e47b41074..abd6e01ce8 100644 --- a/sched/sched_util.C +++ b/sched/sched_util.C @@ -31,6 +31,9 @@ using namespace std; #include "server_types.h" const char* STOP_TRIGGER_FILENAME = "../stop_servers"; + // NOTE: this be the same name as used by the "start" script +const int STOP_SIGNAL = SIGHUP; + // NOTE: this be the same signal as used by the "start" script void write_pid_file(const char* filename) { FILE* fpid = fopen(filename, "w"); @@ -43,19 +46,19 @@ void write_pid_file(const char* filename) { } // caught_sig_int will be set to true if SIGINT is caught. -bool caught_sig_int = false; -static void sigint_handler(int) { - fprintf(stderr, "SIGINT\n"); - caught_sig_int = true; +bool caught_stop_signal = false; +static void stop_signal_handler(int) { + fprintf(stderr, "GOT STOP SIGNAL\n"); + caught_stop_signal = true; } -void install_sigint_handler() { - signal(SIGINT, sigint_handler); - // SIGINT is now default again so hitting ^C again will kill the program. +void install_stop_signal_handler() { + signal(STOP_SIGNAL, stop_signal_handler); + // handler is now default again so hitting ^C again will kill the program. } void check_stop_trigger() { - if (caught_sig_int) { + if (caught_stop_signal) { log_messages.printf(SchedMessages::CRITICAL, "Quitting due to SIGINT\n"); exit(0); } diff --git a/sched/sched_util.h b/sched/sched_util.h index 7a8c605274..ba783797e0 100644 --- a/sched/sched_util.h +++ b/sched/sched_util.h @@ -45,8 +45,8 @@ extern void set_debug_level(int); extern void check_stop_trigger(); extern bool is_stopfile_present(); extern void update_average(double, double, double&, double&); -extern void install_sigint_handler(); -extern bool caught_sig_int; +extern void install_stop_signal_handler(); +extern bool caught_stop_signal; class SchedMessages : public Messages { diff --git a/sched/transitioner.C b/sched/transitioner.C index 4b285ae281..c5d9a35e9d 100644 --- a/sched/transitioner.C +++ b/sched/transitioner.C @@ -415,7 +415,7 @@ int main(int argc, char** argv) { // write_pid_file(PIDFILE); log_messages.printf(SchedMessages::NORMAL, "Starting\n"); - install_sigint_handler(); + install_stop_signal_handler(); main_loop(one_pass); } diff --git a/sched/validate.C b/sched/validate.C index a13e15552c..fe785bc1d2 100644 --- a/sched/validate.C +++ b/sched/validate.C @@ -391,7 +391,7 @@ int main(int argc, char** argv) { // write_pid_file(PIDFILE); log_messages.printf(SchedMessages::NORMAL, "Starting validator\n"); - install_sigint_handler(); + install_stop_signal_handler(); main_loop(one_pass); } diff --git a/test/testbase.py b/test/testbase.py index a246e2c6f5..3153d9bac9 100644 --- a/test/testbase.py +++ b/test/testbase.py @@ -318,7 +318,7 @@ class TestProject(Project): def run(self): self.sched_install('make_work', max_wus = self.num_wu, min_quorum = self.redundancy) self.sched_install('assimilator') - # self.sched_install('file_deleter') + self.sched_install('file_deleter') self.sched_install('validate_test') self.sched_install('feeder') self.sched_install('transitioner') @@ -670,6 +670,7 @@ def run_check_all(): all_projects.stop_progress_meter() print # all_hosts.stop() + time.sleep(12) all_projects.stop() all_projects.check()