Josh, Did you not want to commit this to the live website?
-Ethan On Wed, Sep/19/2007 09:42:36AM, [email protected] wrote: > Author: jjhursey > Date: 2007-09-19 09:42:36 EDT (Wed, 19 Sep 2007) > New Revision: 1033 > URL: https://svn.open-mpi.org/trac/mtt/changeset/1033 > > Log: > Stats are collected midnight to midnight. > > Also if we have to guess an mpi_install_id or test_build_id because the client > did not submit a valid one then point it to an 'invalid' tuple. This keeps us > from corrupting the database by guessing wrong. Adjust the schema so that it > inserts 'undef' values at tuple 0 that we can point to. > > > Text files modified: > trunk/server/php/submit/index.php | 16 ++++- > > trunk/server/sql/v3/schemas-v3.sql | 115 > +++++++++++++++++++++++++++++++++++++++ > trunk/server/sql/v3/stats/collect-stats.pl | 3 > > 3 files changed, 128 insertions(+), 6 deletions(-) > > Modified: trunk/server/php/submit/index.php > ============================================================================== > --- trunk/server/php/submit/index.php (original) > +++ trunk/server/php/submit/index.php 2007-09-19 09:42:36 EDT (Wed, 19 Sep > 2007) > @@ -714,7 +714,9 @@ > if(!isset($test_build_id) || > 0 == strlen($test_build_id) || > !preg_match("/^\d+$/", $test_build_id, $m) ) { > - $test_build_id = find_test_build_id(); > + # We could guess using: $test_build_id = find_test_build_id(); > + # But we should probably just pint it to an invalid row for safety. > + $test_build_id = 0; > $error_output .= ("-------------------------------\n". > "Invalid test_build_id ($orig_test_build_id) > given. ". > "Guessing that it should be $test_build_id \n". > @@ -729,7 +731,9 @@ > "test_build_id = '".$test_build_id."'"); > $valid_id = select_scalar($select_stmt); > if( !isset($valid_id) ) { > - $test_build_id = find_test_build_id(); > + # We could guess using: $test_build_id = find_test_build_id(); > + # But we should probably just pint it to an invalid row for > safety. > + $test_build_id = 0; > $error_output .= ("-------------------------------\n". > "Invalid test_build_id ($orig_test_build_id) > given. " . > "Guessing that it should be $test_build_id \n". > @@ -876,7 +880,9 @@ > if(!isset($mpi_install_id) || > 0 == strlen($mpi_install_id) || > !preg_match("/^\d+$/", $orig_mpi_install_id, $m) ) { > - $mpi_install_id = find_mpi_install_id(); > + # We could guess using: $mpi_install_id = find_mpi_install_id(); > + # But we should probably just pint it to an invalid row for safety. > + $mpi_install_id = 0; > $error_output .= ("-------------------------------\n". > "Invalid mpi_install_id ($orig_mpi_install_id) > given. ". > "Guessing that it should be $mpi_install_id .\n". > @@ -893,7 +899,9 @@ > $valid_id = select_scalar($select_stmt); > > if( !isset($valid_id) ) { > - $mpi_install_id = find_mpi_install_id(); > + # We could guess using: $mpi_install_id = find_mpi_install_id(); > + # But we should probably just pint it to an invalid row for > safety. > + $mpi_install_id = 0; > $error_output .= ("-------------------------------\n". > "Invalid mpi_install_id ($orig_mpi_install_id) > given. ". > "Guessing that it should be $mpi_install_id > \n". > > Modified: trunk/server/sql/v3/schemas-v3.sql > ============================================================================== > --- trunk/server/sql/v3/schemas-v3.sql (original) > +++ trunk/server/sql/v3/schemas-v3.sql 2007-09-19 09:42:36 EDT (Wed, > 19 Sep 2007) > @@ -56,6 +56,8 @@ > > PRIMARY KEY (compute_cluster_id) > ); > +-- An invlid row in case we need it > +INSERT INTO compute_cluster VALUES ('0', 'undef', 'undef', 'undef', 'undef', > 'undef'); > > -- > -- Submit Table > @@ -75,6 +77,8 @@ > > PRIMARY KEY (submit_id) > ); > +-- An invlid row in case we need it > +INSERT INTO submit VALUES ('0', 'undef', 'undef', 'undef', 'undef'); > > -- > -- Compiler Table > @@ -95,7 +99,8 @@ > > PRIMARY KEY (compiler_id) > ); > - > +-- An invlid row in case we need it > +INSERT INTO compiler VALUES ('0', 'undef', 'undef'); > > -- > -- MPI Get Table > @@ -116,6 +121,8 @@ > > PRIMARY KEY (mpi_get_id) > ); > +-- An invlid row in case we need it > +INSERT INTO mpi_get VALUES ('0', 'undef', 'undef'); > > -- > -- Results: Description Normalization table > @@ -140,6 +147,8 @@ > > PRIMARY KEY (result_message_id) > ); > +-- Insert an invalid tuple in case we need it. > +INSERT INTO result_message VALUES('0', 'undef'); > > -- > -- Results: Environment Normalization table > @@ -191,6 +200,8 @@ > > PRIMARY KEY (mpi_install_configure_id) > ); > +-- An invlid row in case we need it > +INSERT INTO mpi_install_configure_args VALUES ('0', DEFAULT, DEFAULT, > DEFAULT, 'undef'); > > -- > -- Collect 'results' data into a table for easy updating > @@ -251,6 +262,50 @@ > FOREIGN KEY (result_message_id) REFERENCES > result_message(result_message_id) > > ) INHERITS(results_fields); > +-- An invlid row in case we need it > +INSERT INTO mpi_install > + (description_id, > + start_timestamp, > + test_result, > + trial, > + submit_timestamp, > + duration, > + environment_id, > + result_stdout, > + result_stderr, > + result_message_id, > + merge_stdout_stderr, > + exit_value, > + exit_signal, > + client_serial, > + submit_id, > + compute_cluster_id, > + mpi_install_compiler_id, > + mpi_get_id, > + mpi_install_configure_id, > + mpi_install_id > + ) VALUES ( > + '1', > + TIMESTAMP '2006-11-01', > + '1', > + DEFAULT, > + TIMESTAMP '2006-11-01', > + INTERVAL '1', > + '0', > + 'undef', > + 'undef', > + '0', > + DEFAULT, > + '0', > + DEFAULT, > + DEFAULT, > + '0', > + '0', > + '0', > + '0', > + '0', > + '0' > + ); > > -- > -- Test Suite Table > @@ -269,6 +324,9 @@ > > PRIMARY KEY (test_suite_id) > ); > +-- An invalid tuple if we need it > +INSERT INTO test_suites VALUES ('0', 'undef', 'undef'); > + > > -- > -- Ind. Test Name Table > @@ -293,6 +351,8 @@ > > FOREIGN KEY (test_suite_id) REFERENCES test_suites(test_suite_id) > ); > +-- An invalid tuple if we need it > +INSERT INTO test_names VALUES('0', '0', 'undef', 'undef'); > > -- > -- Test Build Table > @@ -327,6 +387,59 @@ > FOREIGN KEY (result_message_id) REFERENCES > result_message(result_message_id) > ) INHERITS(results_fields); > > +-- An invlid row in case we need it > +INSERT INTO test_build > + (description_id, > + start_timestamp, > + test_result, > + trial, > + submit_timestamp, > + duration, > + environment_id, > + result_stdout, > + result_stderr, > + result_message_id, > + merge_stdout_stderr, > + exit_value, > + exit_signal, > + client_serial, > + > + submit_id, > + compute_cluster_id, > + mpi_install_compiler_id, > + mpi_get_id, > + mpi_install_configure_id, > + mpi_install_id, > + > + test_suite_id, > + test_build_compiler_id, > + test_build_id > + ) VALUES ( > + '1', > + TIMESTAMP '2006-11-01', > + '1', > + DEFAULT, > + TIMESTAMP '2006-11-01', > + INTERVAL '1', > + '0', > + 'undef', > + 'undef', > + '0', > + DEFAULT, > + '0', > + DEFAULT, > + DEFAULT, > + '0', > + '0', > + '0', > + '0', > + '0', > + '0', > + '0', > + '0', > + '0' > + ); > + > -- > -- Latency/Bandwidth Table > -- > > Modified: trunk/server/sql/v3/stats/collect-stats.pl > ============================================================================== > --- trunk/server/sql/v3/stats/collect-stats.pl (original) > +++ trunk/server/sql/v3/stats/collect-stats.pl 2007-09-19 09:42:36 EDT > (Wed, 19 Sep 2007) > @@ -361,7 +361,8 @@ > # > # Render time segments > # > - my $time_24_cycle = " 21:00:00"; # 9 pm > + #my $time_24_cycle = " 21:00:00"; # 9 pm > + my $time_24_cycle = " 23:59:59"; # Midnight > my $epoch = "2006-11-24 " . $time_24_cycle; > ($today, $yesterday) = get_times_today(); > ($days_epoch, $months_epoch) = get_times_epoch($epoch, $today); > _______________________________________________ > mtt-svn mailing list > [email protected] > http://www.open-mpi.org/mailman/listinfo.cgi/mtt-svn
