Make it possible to notify a slave is still online

This commit is contained in:
Hannes Verschore 2014-01-03 14:09:15 +00:00
Родитель 056a7313d8
Коммит 463c1b92ae
1 изменённых файлов: 45 добавлений и 23 удалений

Просмотреть файл

@ -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());
}