Fixes #142: allow to define other scale directions for sub-benchmarks;

This commit is contained in:
Benjamin Bouvier 2017-06-29 19:31:23 +02:00
Родитель cb4484fdb1
Коммит a4be0b2fbd
5 изменённых файлов: 29 добавлений и 11 удалений

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

@ -4,7 +4,8 @@ set_error_handler(function($errno, $errstr) {
echo $errstr."\n";
die("Did you set /etc/awfy-server.config ?\n");
});
include "../website/internals.php";
include "../website/lib/internals.php";
restore_error_handler();
mysql_connect($config->mysql_host, $config->mysql_username, $config->mysql_password) or die("ERROR: " . mysql_error());

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

@ -0,0 +1,7 @@
<?php
$migrate = function() {
mysql_query("ALTER TABLE `awfy_suite_test` ADD `better_direction` TINYINT NOT NULL DEFAULT '0' AFTER `visible`; ");
};
$rollback = function() {
};

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

@ -306,8 +306,8 @@ def condense_suite(cx, machine, suite):
export(aggregated_file, j)
# Note: only run the subtest condenser when suite was changed.
for test_name in suite.tests:
test_path = suite.name + '-' + test_name + '-' + str(machine.id)
for subtest in suite.tests:
test_path = suite.name + '-' + subtest.name + '-' + str(machine.id)
# Condense test
change = condense(cx, prefix + 'bk-', test_path)

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

@ -6,6 +6,16 @@
import awfy
import time
class SubBenchmark(object):
def __init__(self, name, direction):
self.name = name
self.direction = int(direction)
def export(self):
# No need to export more than the name, to not break backwards
# compatibility.
return self.name
class Benchmark(object):
def __init__(self, suite_id, name, description, direction, sort_order, visible):
self.id = suite_id
@ -18,21 +28,21 @@ class Benchmark(object):
# Get a list of individual tests
self.tests = []
c = awfy.db.cursor()
c.execute("SELECT t.name \
c.execute("SELECT t.name, t.better_direction \
FROM awfy_suite_test t \
JOIN awfy_suite_version v ON v.id = t.suite_version_id \
WHERE suite_id = %s \
AND visible = 1 \
GROUP BY t.name", (suite_id,))
GROUP BY t.name, t.better_direction", (suite_id,))
for row in c.fetchall():
self.tests.append(row[0])
self.tests.append(SubBenchmark(row[0], row[1]))
def export(self):
return { "id": self.id,
"name": self.name,
"description": self.description,
"direction": self.direction,
"tests": self.tests,
"tests": [subtest.export() for subtest in self.tests],
"sort_order": self.sort_order,
"visible": self.visible
}

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

@ -312,17 +312,17 @@ def update(cx, machine, suite):
if not new_rows:
return
for test_name in suite.tests:
for subtest in suite.tests:
def fetch_test(machine, finish_stamp = (0,"UNIX_TIMESTAMP()"), approx_stamp = (0,"UNIX_TIMESTAMP()")):
return fetch_test_scores(machine.id, suite.id, test_name, finish_stamp, approx_stamp)
return fetch_test_scores(machine.id, suite.id, subtest.name, finish_stamp, approx_stamp)
prefix = ""
if suite.visible == 2:
prefix = "auth-"
direction = suite.direction
direction = suite.direction if subtest.direction == 0 else subtest.direction
prefix += 'bk-raw-' + suite.name + '-' + test_name + '-' + str(machine.id)
prefix += 'bk-raw-' + suite.name + '-' + subtest.name + '-' + str(machine.id)
perform_update(cx, machine, direction, prefix, fetch_test)
def export_master(cx):