From 463c1b92ae288fe1f47ccda55a9a612ad246ab21 Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Fri, 3 Jan 2014 14:09:15 +0000 Subject: [PATCH] Make it possible to notify a slave is still online --- website/UPDATE.php | 68 ++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/website/UPDATE.php b/website/UPDATE.php index be12925..cea520a 100644 --- a/website/UPDATE.php +++ b/website/UPDATE.php @@ -7,6 +7,9 @@ require_once("internals.php"); init_database(); +// Start a full benchmark run. Request a token/number used to report/group +// benchmark scores. +// (Note: cset is not used anymore. It is saved in awfy_build now) if (isset($_GET['run']) && $_GET['run'] == 'yes') { $MACHINE = GET_int('MACHINE'); $CSET = mysql_real_escape_string(GET_string('CSET')); @@ -15,7 +18,12 @@ if (isset($_GET['run']) && $_GET['run'] == 'yes') { ($MACHINE, UNIX_TIMESTAMP(), '$CSET')") or die("ERROR: " . mysql_error()); print("id=" . mysql_insert_id()); -} else if (isset($_GET['run']) && $_GET['run'] == 'finish') { + die(); +} + +// Finish a full benchmark run. Scores will only become visible from now on +// (when status equals 1). +if (isset($_GET['run']) && $_GET['run'] == 'finish') { $runid = GET_int('runid'); $status = GET_int('status'); if (isset($_GET['error'])) @@ -27,7 +35,10 @@ if (isset($_GET['run']) && $_GET['run'] == 'yes') { error = $error WHERE id = $runid") or die("ERROR: " . mysql_error()); -} else if (isset($_GET['run']) && $_GET['run'] == 'addEngine') { + die(); +} + +if (isset($_GET['run']) && $_GET['run'] == 'addEngine') { $runid = GET_int('runid'); $mode_id = find_mode(GET_string('name')); $cset = mysql_real_escape_string(GET_string('cset')); @@ -36,26 +47,37 @@ if (isset($_GET['run']) && $_GET['run'] == 'yes') { VALUES ($runid, $mode_id, '$cset')") or die("ERROR: " . mysql_error()); -} else { - $name = mysql_real_escape_string(GET_string('name')); - $time = mysql_real_escape_string(GET_string('time')); - $suite_id = find_suite(GET_string('suite')); - $mode_id = find_mode(GET_string('mode')); - $run = GET_int('run'); - if ($name == '__total__') { - mysql_query("INSERT INTO awfy_score - (run_id, suite_id, mode_id, score) - VALUES - ($run, $suite_id, $mode_id, $time)") - or die("ERROR: " . mysql_error()); - } else { - $test_id = find_or_add_test($suite_id, $name); - mysql_query("INSERT INTO awfy_breakdown - (run_id, mode_id, score, test_id) - VALUES - ($run, $mode_id, $time, $test_id)") - or die("ERROR: " . mysql_error()); - } + die(); } -?> +// Report that a slave is still awake when there are no benchmarks results +// to send. +if (isset($_GET['awake']) && $_GET['awake'] == 'yes') { + $MACHINE = GET_int('MACHINE'); + mysql_query("UPDATE awfy_machine + SET last_checked = UNIX_TIMESTAMP() + WHERE id = $MACHINE") + or die("ERROR: " . mysql_error()); + die(); +} + +// Report score of a benchmark total or subtest. +$name = mysql_real_escape_string(GET_string('name')); +$time = mysql_real_escape_string(GET_string('time')); +$suite_id = find_suite(GET_string('suite')); +$mode_id = find_mode(GET_string('mode')); +$run = GET_int('run'); +if ($name == '__total__') { + mysql_query("INSERT INTO awfy_score + (run_id, suite_id, mode_id, score) + VALUES + ($run, $suite_id, $mode_id, $time)") + or die("ERROR: " . mysql_error()); +} else { + $test_id = find_or_add_test($suite_id, $name); + mysql_query("INSERT INTO awfy_breakdown + (run_id, mode_id, score, test_id) + VALUES + ($run, $mode_id, $time, $test_id)") + or die("ERROR: " . mysql_error()); +}