* Perform builds in parallel.

* Turn off sqlite's synchronous mode because fsync() performance
  *really* sucks on ext3 (it syncs the entire filesystem).  See
  https://bugzilla.mozilla.org/show_bug.cgi?id=421482
This commit is contained in:
Eelco Dolstra 2008-11-11 10:27:36 +00:00
parent 8f5e7c319c
commit 0f24c11292
4 changed files with 39 additions and 6 deletions

View file

@ -5,11 +5,12 @@
<table class="tablesorter">
<thead>
<tr><th>Priority</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
<tr><th>#</th><th>Priority</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
</thead>
<tbody>
[% FOREACH job IN jobs -%]
<tr [% IF job.busy %]class="runningJob"[% END %] >
<td>[% job.id %]</td>
<td>[% job.priority %]</td>
<td><tt>[% job.project.name %]</tt></td>
<td><tt>[% job.jobset.name %]</tt></td>

View file

@ -7,6 +7,8 @@ use HydraFrontend::Schema;
my $db = HydraFrontend::Schema->connect("dbi:SQLite:dbname=hydra.sqlite", "", "", {});
$db->storage->dbh->do("PRAGMA synchronous = OFF;");
sub isValidPath {
my $path = shift;
@ -124,7 +126,10 @@ sub buildJob {
}
$job->delete;
});
print "STOP ", time, "\n";
}

View file

@ -1,11 +1,14 @@
#! @perl@ -w
use strict;
use POSIX qw(dup2);
use HydraFrontend::Schema;
my $db = HydraFrontend::Schema->connect("dbi:SQLite:dbname=hydra.sqlite", "", "", {});
$db->storage->dbh->do("PRAGMA synchronous = OFF;");
# Unlock jobs whose building process has died.
$db->txn_do(sub {
@ -22,8 +25,7 @@ $db->txn_do(sub {
});
while (1) {
sub checkJobs {
print "looking for runnable jobs...\n";
my $job;
@ -46,9 +48,20 @@ while (1) {
# Start the job. We need to do this outside the transaction in
# case it aborts or something.
if (defined $job) {
print "starting job ", $job->id, "\n";
my $id = $job->id;
print "starting job $id\n";
eval {
system("perl -I HydraFrontend/lib -w ./build.pl " . $job->id);
my $child = fork();
die unless defined $child;
if ($child == 0) {
open LOG, ">logs/$id" or die;
POSIX::dup2(fileno(LOG), 1) or die;
POSIX::dup2(fileno(LOG), 2) or die;
exec("perl", "-IHydraFrontend/lib", "-w",
"./build.pl", $id);
warn "cannot start job " . $id;
_exit(1);
}
};
if ($@) {
warn $@;
@ -59,6 +72,14 @@ while (1) {
});
}
}
}
while (1) {
eval {
checkJobs;
};
warn $@ if $@;
print "sleeping...\n";
sleep(10);

View file

@ -7,6 +7,8 @@ use HydraFrontend::Schema;
my $db = HydraFrontend::Schema->connect("dbi:SQLite:dbname=hydra.sqlite", "", "", {});
$db->storage->dbh->do("PRAGMA synchronous = OFF;");
sub isValidPath {
my $path = shift;
@ -250,4 +252,8 @@ sub checkJobs {
}
while (1) {
checkJobs;
print "sleeping...\n";
sleep 10;
}