Merge remote-tracking branch 'upstream/master' into ca-derivations-prep

This commit is contained in:
John Ericson 2023-12-11 12:42:43 -05:00
commit 8783dd53f6
2 changed files with 21 additions and 30 deletions

View file

@ -310,9 +310,6 @@ static BuildResult performBuild(
counter & nrStepsBuilding counter & nrStepsBuilding
) )
{ {
BuildResult result;
conn.to << ServeProto::Command::BuildDerivation << localStore.printStorePath(drvPath); conn.to << ServeProto::Command::BuildDerivation << localStore.printStorePath(drvPath);
writeDerivation(conn.to, localStore, drv); writeDerivation(conn.to, localStore, drv);
conn.to << options.maxSilentTime << options.buildTimeout; conn.to << options.maxSilentTime << options.buildTimeout;
@ -325,39 +322,31 @@ static BuildResult performBuild(
} }
conn.to.flush(); conn.to.flush();
result.startTime = time(0); BuildResult result;
time_t startTime, stopTime;
startTime = time(0);
{ {
MaintainCount<counter> mc(nrStepsBuilding); MaintainCount<counter> mc(nrStepsBuilding);
result.status = (BuildResult::Status)readInt(conn.from); result = ServeProto::Serialise<BuildResult>::read(localStore, conn);
} }
result.stopTime = time(0); stopTime = time(0);
if (!result.startTime) {
result.errorMsg = readString(conn.from); // If the builder gave `startTime = 0`, use our measurements
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 3) { // instead of the builder's.
result.timesBuilt = readInt(conn.from); //
result.isNonDeterministic = readInt(conn.from); // Note: this represents the duration of a single round, rather
auto start = readInt(conn.from); // than all rounds.
auto stop = readInt(conn.from); result.startTime = startTime;
if (start && start) { result.stopTime = stopTime;
/* Note: this represents the duration of a single
round, rather than all rounds. */
result.startTime = start;
result.stopTime = stop;
}
} }
// Get the newly built outputs, either from the remote if it // If the protocol was too old to give us `builtOutputs`, initialize
// supports it, or by introspecting the derivation if the remote is // it manually by introspecting the derivation.
// too old. if (GET_PROTOCOL_MINOR(conn.remoteVersion) < 6)
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 6) { {
auto builtOutputs = ServeProto::Serialise<DrvOutputs>::read(localStore, conn);
for (auto && [output, realisation] : builtOutputs)
result.builtOutputs.insert_or_assign(
std::move(output.outputName),
std::move(realisation));
} else {
// If the remote is too old to handle CA derivations, we cant get this // If the remote is too old to handle CA derivations, we cant get this
// far anyways // far anyways
assert(drv.type().hasKnownOutputPaths()); assert(drv.type().hasKnownOutputPaths());

View file

@ -39,7 +39,9 @@ use Hydra::Helper::Exec;
sub new { sub new {
my ($class, %opts) = @_; my ($class, %opts) = @_;
my $dir = File::Temp->newdir(); # Cleanup will be managed by yath. By the default it will be cleaned
# up, but can be kept to aid in debugging test failures.
my $dir = File::Temp->newdir(CLEANUP => 0);
$ENV{'HYDRA_DATA'} = "$dir/hydra-data"; $ENV{'HYDRA_DATA'} = "$dir/hydra-data";
mkdir $ENV{'HYDRA_DATA'}; mkdir $ENV{'HYDRA_DATA'};