This commit is contained in:
Hannes Verschore 2015-10-29 09:27:54 -07:00
Родитель c87328a1bf
Коммит dabba6ac18
7 изменённых файлов: 29 добавлений и 57 удалений

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

@ -163,21 +163,6 @@
ga('send', 'pageview');
</script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//arewefastyet.com/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//arewefastyet.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>

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

@ -13,16 +13,16 @@ class TaskQueue {
function has_active_task() {
$qTask = mysql_query("SELECT *
FROM control_task_queue
WHERE control_unit_id = {$this->unit} AND busy = 1
ORDER BY id LIMIT 1");
WHERE control_unit_id = {$this->unit_id} AND busy = 1
ORDER BY id LIMIT 1") or die(mysql_error());
return mysql_num_rows($qTask) != 0;
}
function has_queued_tasks() {
$qTask = mysql_query("SELECT *
FROM control_task_queue
WHERE control_unit_id = $unit and busy = 0
ORDER BY id LIMIT 1");
WHERE control_unit_id = {$this->unit_id} and busy = 0
ORDER BY id LIMIT 1") or die(mysql_error());
return mysql_num_rows($qTask) != 0;
}
@ -30,11 +30,11 @@ class TaskQueue {
function pop() {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = $unit and busy = 0
ORDER BY id LIMIT 1");
WHERE control_unit_id = {$this->unit_id} and busy = 0
ORDER BY id LIMIT 1") or die(mysql_error());
$task = mysql_fetch_object($qTask);
$task = QueuedTask($task->id);
$task = new QueuedTask($task->id);
$task->setBusy();
return $task;

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

@ -36,7 +36,8 @@ class ManipulateTask extends Task {
$commands = BashInterpreter::matchCommand($this->task, "python build.py");
foreach ($commands as $command) {
$source_matches = BashInterpreter::matchFlag($command, "-s");
$engine = $this->source_rules()[$source_matches[0]];
$source_rules = $this->source_rules();
$engine = $source_rules[$source_matches[0]];
print_r($removed_engines);
if (in_array($engine, $removed_engines)) {
$this->removeBuildOrDownloadCommand($command);
@ -47,8 +48,8 @@ class ManipulateTask extends Task {
}
public function update_modes($modes) {
$engines = [];
$configs = [];
$engines = Array();
$configs = Array();
$mode_rules = array_flip($this->mode_rules());
foreach ($modes as $mode) {
@ -79,7 +80,7 @@ class ManipulateTask extends Task {
$commands = BashInterpreter::matchCommand($this->task, "python build.py");
foreach ($commands as $command) {
$revision_matches = BashInterpreter::matchFlag($command, "-r");
for ($revision_matches as $revision) {
foreach ($revision_matches as $revision) {
$this->task = BashInterpreter::removeFlagFromCommand($this->task, $command, "-r ".$revision);
}
}

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

@ -6,7 +6,7 @@ require_once("DB/Mode.php");
class RetriggerController {
public function __construct() {
$this->tasks = [];
$this->tasks = Array();
$this->unit_id = 0;
}
@ -16,7 +16,7 @@ class RetriggerController {
$qTask = mysql_query("SELECT * FROM control_tasks WHERE control_unit_id = $unit_id");
while ($task = mysql_fetch_object($qTask)) {
$task = new ManipulateTask($task);
$task = new ManipulateTask($task->task);
$retrigger->tasks[] = $task;
}
return $retrigger;
@ -31,7 +31,7 @@ class RetriggerController {
if (!($mode_id == 0 || $task->mode_id == 0 || $task->mode_id == $mode_id))
continue;
$task = new ManipulateTask($task);
$task = new ManipulateTask($task->task);
if ($mode_id != 0)
$task->update_modes($mode->mode());
@ -58,7 +58,7 @@ class RetriggerController {
foreach ($this->tasks as $task) {
mysql_query("INSERT INTO control_task_queue
(control_unit_id, task)
VALUES ({$this->unit_id}, '".mysql_escape_string($task)."')");
VALUES ({$this->unit_id}, '".mysql_escape_string($task->task())."')");
}
}
}

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

@ -7,11 +7,11 @@ class Task {
// This makes the transition from source to engine.
// Note: an engine can have multiple sources.
public function source_rules() {
return [
return Array(
"mozilla" => "firefox",
"v8" => "chrome",
"webkit" => "webkit"
];
);
}
// The execute function looks at engine+config to decide which
@ -19,7 +19,7 @@ class Task {
// Though it is possible to add some extra rules in the task
// itself. These are not accounted for (TODO).
public function mode_rules() {
return [
return Array(
"firefox,default" => "jmim",
"firefox,noasmjs" => "noasmjs",
"firefox,unboxedobjects" => "unboxedobjects",
@ -29,7 +29,7 @@ class Task {
"webkit,default" => "jsc",
"native,default" => "clang",
"servo,default" => "servo"
];
);
}
public function __construct($task) {
@ -41,7 +41,7 @@ class Task {
}
public function configs() {
$configs = [];
$configs = Array();
$commands = BashInterpreter::matchCommand($this->task, "python execute.py");
foreach ($commands as $command) {
$config_matches = BashInterpreter::matchFlag($command, "-c");
@ -53,7 +53,7 @@ class Task {
}
public function engines() {
$engines = [];
$engines = Array();
// Fetch all engines that have been build.
$commands = BashInterpreter::matchCommand($this->task, "python build.py");
@ -62,7 +62,8 @@ class Task {
if (count($source_matches) != 1)
throw new Error("Expected one match.");
$engines[] = $this->source_rules()[$source_matches[0]];
$source_rules = $this->source_rules();
$engines[] = $source_rules[$source_matches[0]];
}
// Fetch all engines that have been downloaded.
@ -75,7 +76,7 @@ class Task {
$engines = $this->engines();
$mode_rules = $this->mode_rules();
$modes = [];
$modes = Array();
foreach ($configs as $config) {
foreach ($engines as $engine) {
$rule = $engine.",".$config;
@ -88,7 +89,7 @@ class Task {
}
public function benchmarks() {
$configs = [];
$configs = Array();
$commands = BashInterpreter::matchCommand($this->task, "python execute.py");
foreach ($commands as $command) {
$config_matches = BashInterpreter::matchFlag($command, "-b");

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

@ -134,20 +134,5 @@
ga('send', 'pageview');
</script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//arewefastyet.com/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//arewefastyet.com/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>

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

@ -17,17 +17,17 @@ if ($unit = GET_int("unit")) {
if ($queue->has_active_task())
slack("requesting new task, while old task is still running!");
if (!$queue->has_queued_tasks())
if (!$queue->has_queued_tasks()) {
$retrigger = RetriggerController::fromUnit($unit);
$retrigger->enqueue();
}
$task = $queue->pop();
echo json_encode([
echo json_encode(Array(
"task" => $task->task(),
"id" => $task->id()
]);
));
die();