From 48af914e28704b6271c24452365cd1c11cca1384 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 25 Feb 2015 16:21:54 +0100 Subject: [PATCH] When propagating failure, propagate the duration and machine Previously the duration would just show as "0" and you would have to search for the original build to get the duration. --- src/script/hydra-build | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/script/hydra-build b/src/script/hydra-build index c77f403d..4a977ca5 100755 --- a/src/script/hydra-build +++ b/src/script/hydra-build @@ -39,7 +39,7 @@ sub nextFreeStepNr { sub failDependents { - my ($drvPath, $status, $errorMsg, $dependents) = @_; + my ($drvPath, $status, $errorMsg, $dependents, $startTime, $stopTime, $machine) = @_; # Get the referrer closure of $drvPath. my $dependentDrvs = Set::Scalar->new(computeFSClosure(1, 0, $drvPath)); @@ -71,9 +71,10 @@ sub failDependents { , drvpath => $drvPath , busy => 0 , status => $status - , starttime => $time - , stoptime => $time + , starttime => $startTime + , stoptime => $stopTime , errormsg => $errorMsg + , machine => $machine }); addBuildStepOutputs($step); @@ -204,10 +205,17 @@ sub doBuild { } else { $errorMsg = $4; } + my $now = time; + my $stepStartTime = $now; + my $stepStopTime = $now; + my $machine = undef; txn_do($db, sub { if ($buildSteps{$drvPathStep}) { my $step = $build->buildsteps->find({stepnr => $buildSteps{$drvPathStep}}) or die; - $step->update({busy => 0, status => $status, errormsg => $errorMsg, stoptime => time}); + $stepStartTime = $step->starttime; + $stepStopTime = $now; + $machine = $step->machine; + $step->update({busy => 0, status => $status, errormsg => $errorMsg, stoptime => $now}); } # Don't write a record if this derivation already # failed previously. This can happen if this is a @@ -219,8 +227,8 @@ sub doBuild { , drvpath => $drvPathStep , busy => 0 , status => $status - , starttime => time - , stoptime => time + , starttime => $now + , stoptime => $now , errormsg => $errorMsg }); addBuildStepOutputs($step); @@ -228,7 +236,7 @@ sub doBuild { }); # Immediately fail all builds that depend on this derivation. - failDependents($drvPathStep, $status, $errorMsg, $dependents); + failDependents($drvPathStep, $status, $errorMsg, $dependents, $stepStartTime, $stepStopTime, $machine); } elsif (/^@\s+substituter-started\s+(\S+)\s+(\S+)$/) {