Remove the logfile and logSize columns from the database

It's pointless to store these, since Nix knows where the logs are.
Also handle (in fact require) Nix's new log storage scheme.  Also some
cleanups in the build page.
This commit is contained in:
Eelco Dolstra
2013-01-22 22:48:02 +01:00
parent 36c2bf2f52
commit 30e5185acf
30 changed files with 299 additions and 229 deletions

View File

@ -156,7 +156,7 @@ sub sendEmailNotification {
$inputsTable->load(@lines);
my $loglines = 50;
my $logtext = logContents($build->logfile, $loglines);
my $logtext = logContents($build->drvpath, $loglines);
$logtext = removeAsciiEscapes($logtext);
my $body = "Hi,\n"
@ -267,7 +267,6 @@ sub doBuild {
, drvpath => $drvPathStep
, outpath => $2
, system => $3
, logfile => $4
, busy => 1
, starttime => time
});
@ -314,7 +313,6 @@ sub doBuild {
, type => 0 # = build
, drvpath => $drvPathStep
, outpath => $2
, logfile => getBuildLog($drvPathStep)
, busy => 0
, status => 1
, starttime => time
@ -376,10 +374,6 @@ sub doBuild {
}
done:
my $logfile = getBuildLog($drvPath);
my $logsize = defined $logfile ? stat($logfile)->size : 0;
my $size = 0;
my $closuresize = 0;
@ -409,8 +403,6 @@ sub doBuild {
, buildstatus => $buildStatus
, starttime => $startTime
, stoptime => $stopTime
, logfile => $logfile
, logsize => $logsize
, size => $size
, closuresize => $closuresize
, errormsg => $errormsg

View File

@ -40,9 +40,7 @@ sub unlockDeadBuilds {
}
if ($unlock) {
print "build ", $build->id, " pid $pid died, unlocking\n";
$build->busy(0);
$build->locker("");
$build->update;
$build->update({ busy => 0, locker => ""});
}
}
});
@ -63,8 +61,8 @@ sub findBuildDependencyInQueue {
return unless scalar @drvs > 0;
($depBuild) = $db->resultset('Builds')->search(
{ drvpath => [ @drvs ], finished => 0, busy => 0, enabled => 1, disabled => 0 },
{ join => ['project'], rows => 1 } ) ;
{ drvpath => [ @drvs ], finished => 0, busy => 0, enabled => 1, disabled => 0 },
{ join => ['project'], rows => 1 } ) ;
return $depBuild;
}
@ -113,11 +111,12 @@ sub checkBuilds {
my $logfile = getcwd . "/logs/" . $build->id;
mkdir(dirname $logfile);
unlink($logfile);
$build->busy(1);
$build->locker($$);
$build->logfile($logfile);
$build->starttime(time);
$build->update;
$build->update(
{ busy => 1
, locker => $$
, logfile => $logfile
, starttime => time()
});
push @buildsStarted, $build;
}
}