forked from lix-project/hydra
Use ServeProto::BuildOption
More deduplication with Nix.
This commit is contained in:
parent
1d80b72ffb
commit
69a5b00e60
3 changed files with 15 additions and 18 deletions
|
@ -282,7 +282,7 @@ static BuildResult performBuild(
|
||||||
Store & localStore,
|
Store & localStore,
|
||||||
StorePath drvPath,
|
StorePath drvPath,
|
||||||
const BasicDerivation & drv,
|
const BasicDerivation & drv,
|
||||||
const State::BuildOptions & options,
|
const ServeProto::BuildOptions & options,
|
||||||
counter & nrStepsBuilding
|
counter & nrStepsBuilding
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ static BuildResult performBuild(
|
||||||
conn.to << options.maxLogSize;
|
conn.to << options.maxLogSize;
|
||||||
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 3) {
|
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 3) {
|
||||||
conn.to
|
conn.to
|
||||||
<< options.repeats // == build-repeat
|
<< options.nrRepeats
|
||||||
<< options.enforceDeterminism;
|
<< options.enforceDeterminism;
|
||||||
}
|
}
|
||||||
conn.to.flush();
|
conn.to.flush();
|
||||||
|
@ -458,7 +458,7 @@ void RemoteResult::updateWithBuildResult(const nix::BuildResult & buildResult)
|
||||||
|
|
||||||
void State::buildRemote(ref<Store> destStore,
|
void State::buildRemote(ref<Store> destStore,
|
||||||
Machine::ptr machine, Step::ptr step,
|
Machine::ptr machine, Step::ptr step,
|
||||||
const BuildOptions & buildOptions,
|
const ServeProto::BuildOptions & buildOptions,
|
||||||
RemoteResult & result, std::shared_ptr<ActiveStep> activeStep,
|
RemoteResult & result, std::shared_ptr<ActiveStep> activeStep,
|
||||||
std::function<void(StepState)> updateStep,
|
std::function<void(StepState)> updateStep,
|
||||||
NarMemberDatas & narMembers)
|
NarMemberDatas & narMembers)
|
||||||
|
@ -510,7 +510,7 @@ void State::buildRemote(ref<Store> destStore,
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
build_remote::handshake(conn, buildOptions.repeats);
|
build_remote::handshake(conn, buildOptions.nrRepeats);
|
||||||
} catch (EndOfFile & e) {
|
} catch (EndOfFile & e) {
|
||||||
child.pid.wait();
|
child.pid.wait();
|
||||||
std::string s = chomp(readFile(result.logFile));
|
std::string s = chomp(readFile(result.logFile));
|
||||||
|
|
|
@ -98,10 +98,13 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
|
||||||
it). */
|
it). */
|
||||||
BuildID buildId;
|
BuildID buildId;
|
||||||
std::optional<StorePath> buildDrvPath;
|
std::optional<StorePath> buildDrvPath;
|
||||||
BuildOptions buildOptions;
|
// Other fields set below
|
||||||
buildOptions.repeats = step->isDeterministic ? 1 : 0;
|
nix::ServeProto::BuildOptions buildOptions {
|
||||||
buildOptions.maxLogSize = maxLogSize;
|
.maxLogSize = maxLogSize,
|
||||||
buildOptions.enforceDeterminism = step->isDeterministic;
|
.nrRepeats = step->isDeterministic ? 1u : 0u,
|
||||||
|
.enforceDeterminism = step->isDeterministic,
|
||||||
|
.keepFailed = false,
|
||||||
|
};
|
||||||
|
|
||||||
auto conn(dbPool.get());
|
auto conn(dbPool.get());
|
||||||
|
|
||||||
|
@ -136,7 +139,7 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
|
||||||
{
|
{
|
||||||
auto i = jobsetRepeats.find(std::make_pair(build2->projectName, build2->jobsetName));
|
auto i = jobsetRepeats.find(std::make_pair(build2->projectName, build2->jobsetName));
|
||||||
if (i != jobsetRepeats.end())
|
if (i != jobsetRepeats.end())
|
||||||
buildOptions.repeats = std::max(buildOptions.repeats, i->second);
|
buildOptions.nrRepeats = std::max(buildOptions.nrRepeats, i->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!build) build = *dependents.begin();
|
if (!build) build = *dependents.begin();
|
||||||
|
@ -147,7 +150,7 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
|
||||||
buildOptions.buildTimeout = build->buildTimeout;
|
buildOptions.buildTimeout = build->buildTimeout;
|
||||||
|
|
||||||
printInfo("performing step ‘%s’ %d times on ‘%s’ (needed by build %d and %d others)",
|
printInfo("performing step ‘%s’ %d times on ‘%s’ (needed by build %d and %d others)",
|
||||||
localStore->printStorePath(step->drvPath), buildOptions.repeats + 1, machine->sshName, buildId, (dependents.size() - 1));
|
localStore->printStorePath(step->drvPath), buildOptions.nrRepeats + 1, machine->sshName, buildId, (dependents.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buildOneDone)
|
if (!buildOneDone)
|
||||||
|
|
|
@ -459,7 +459,7 @@ private:
|
||||||
|
|
||||||
/* How often the build steps of a jobset should be repeated in
|
/* How often the build steps of a jobset should be repeated in
|
||||||
order to detect non-determinism. */
|
order to detect non-determinism. */
|
||||||
std::map<std::pair<std::string, std::string>, unsigned int> jobsetRepeats;
|
std::map<std::pair<std::string, std::string>, size_t> jobsetRepeats;
|
||||||
|
|
||||||
bool uploadLogsToBinaryCache;
|
bool uploadLogsToBinaryCache;
|
||||||
|
|
||||||
|
@ -488,12 +488,6 @@ private:
|
||||||
public:
|
public:
|
||||||
State(std::optional<std::string> metricsAddrOpt);
|
State(std::optional<std::string> metricsAddrOpt);
|
||||||
|
|
||||||
struct BuildOptions {
|
|
||||||
unsigned int maxSilentTime, buildTimeout, repeats;
|
|
||||||
size_t maxLogSize;
|
|
||||||
bool enforceDeterminism;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
nix::MaintainCount<counter> startDbUpdate();
|
nix::MaintainCount<counter> startDbUpdate();
|
||||||
|
@ -578,7 +572,7 @@ private:
|
||||||
|
|
||||||
void buildRemote(nix::ref<nix::Store> destStore,
|
void buildRemote(nix::ref<nix::Store> destStore,
|
||||||
Machine::ptr machine, Step::ptr step,
|
Machine::ptr machine, Step::ptr step,
|
||||||
const BuildOptions & buildOptions,
|
const nix::ServeProto::BuildOptions & buildOptions,
|
||||||
RemoteResult & result, std::shared_ptr<ActiveStep> activeStep,
|
RemoteResult & result, std::shared_ptr<ActiveStep> activeStep,
|
||||||
std::function<void(StepState)> updateStep,
|
std::function<void(StepState)> updateStep,
|
||||||
NarMemberDatas & narMembers);
|
NarMemberDatas & narMembers);
|
||||||
|
|
Loading…
Reference in a new issue