#include <worker.hh>
Public Member Functions | |
Worker (Store &store, Store &evalStore) | |
std::shared_ptr< DerivationGoal > | makeDerivationGoal (const StorePath &drvPath, const OutputsSpec &wantedOutputs, BuildMode buildMode=bmNormal) |
std::shared_ptr< DerivationGoal > | makeBasicDerivationGoal (const StorePath &drvPath, const BasicDerivation &drv, const OutputsSpec &wantedOutputs, BuildMode buildMode=bmNormal) |
std::shared_ptr< PathSubstitutionGoal > | makePathSubstitutionGoal (const StorePath &storePath, RepairFlag repair=NoRepair, std::optional< ContentAddress > ca=std::nullopt) |
std::shared_ptr< DrvOutputSubstitutionGoal > | makeDrvOutputSubstitutionGoal (const DrvOutput &id, RepairFlag repair=NoRepair, std::optional< ContentAddress > ca=std::nullopt) |
GoalPtr | makeGoal (const DerivedPath &req, BuildMode buildMode=bmNormal) |
void | removeGoal (GoalPtr goal) |
void | wakeUp (GoalPtr goal) |
size_t | getNrLocalBuilds () |
size_t | getNrSubstitutions () |
void | childStarted (GoalPtr goal, const std::set< MuxablePipePollState::CommChannel > &channels, bool inBuildSlot, bool respectTimeouts) |
void | childTerminated (Goal *goal, bool wakeSleepers=true) |
void | waitForBuildSlot (GoalPtr goal) |
void | waitForAnyGoal (GoalPtr goal) |
void | waitForAWhile (GoalPtr goal) |
void | run (const Goals &topGoals) |
void | waitForInput () |
unsigned int | failingExitStatus () |
bool | pathContentsGood (const StorePath &path) |
void | markContentsGood (const StorePath &path) |
void | updateProgress () |
Public Attributes | |
const Activity | act |
const Activity | actDerivations |
const Activity | actSubstitutions |
bool | permanentFailure |
bool | timedOut |
bool | hashMismatch |
bool | checkMismatch |
Store & | store |
Store & | evalStore |
std::unique_ptr< HookInstance > | hook |
uint64_t | expectedBuilds = 0 |
uint64_t | doneBuilds = 0 |
uint64_t | failedBuilds = 0 |
uint64_t | runningBuilds = 0 |
uint64_t | expectedSubstitutions = 0 |
uint64_t | doneSubstitutions = 0 |
uint64_t | failedSubstitutions = 0 |
uint64_t | runningSubstitutions = 0 |
uint64_t | expectedDownloadSize = 0 |
uint64_t | doneDownloadSize = 0 |
uint64_t | expectedNarSize = 0 |
uint64_t | doneNarSize = 0 |
bool | tryBuildHook = true |
Coordinates one or more realisations and their interdependencies.
void nix::Worker::childStarted | ( | GoalPtr | goal, |
const std::set< MuxablePipePollState::CommChannel > & | channels, | ||
bool | inBuildSlot, | ||
bool | respectTimeouts ) |
Registers a running child process. inBuildSlot
means that the process counts towards the jobs limit.
void nix::Worker::childTerminated | ( | Goal * | goal, |
bool | wakeSleepers = true ) |
Unregisters a running child process. wakeSleepers
should be false if there is no sense in waking up goals that are sleeping because they can't run yet (e.g., there is no free build slot, or the hook would still say postpone
).
size_t nix::Worker::getNrLocalBuilds | ( | ) |
Return the number of local build processes currently running (but not remote builds via the build hook).
size_t nix::Worker::getNrSubstitutions | ( | ) |
Return the number of substitution processes currently running.
GoalPtr nix::Worker::makeGoal | ( | const DerivedPath & | req, |
BuildMode | buildMode = bmNormal ) |
Make a goal corresponding to the DerivedPath
.
It will be a DerivationGoal
for a DerivedPath::Built
or a SubstitutionGoal
for a DerivedPath::Opaque
.
std::shared_ptr< PathSubstitutionGoal > nix::Worker::makePathSubstitutionGoal | ( | const StorePath & | storePath, |
RepairFlag | repair = NoRepair, | ||
std::optional< ContentAddress > | ca = std::nullopt ) |
bool nix::Worker::pathContentsGood | ( | const StorePath & | path | ) |
Check whether the given valid path exists and has the right contents.
void nix::Worker::removeGoal | ( | GoalPtr | goal | ) |
Remove a dead goal.
void nix::Worker::run | ( | const Goals & | topGoals | ) |
Loop until the specified top-level goals have finished.
void nix::Worker::waitForAnyGoal | ( | GoalPtr | goal | ) |
Wait for any goal to finish. Pretty indiscriminate way to wait for some resource that some other goal is holding.
void nix::Worker::waitForAWhile | ( | GoalPtr | goal | ) |
Wait for a few seconds and then retry this goal. Used when waiting for a lock held by another process. This kind of polling is inefficient, but POSIX doesn't really provide a way to wait for multiple locks in the main select() loop.
void nix::Worker::waitForBuildSlot | ( | GoalPtr | goal | ) |
Put goal
to sleep until a build slot becomes available (which might be right away).
void nix::Worker::waitForInput | ( | ) |
Wait for input to become available.
void nix::Worker::wakeUp | ( | GoalPtr | goal | ) |
Wake up a goal (i.e., there is something for it to do).
bool nix::Worker::checkMismatch |
Set if at least one derivation is not deterministic in check mode.
bool nix::Worker::hashMismatch |
Set if at least one derivation fails with a hash mismatch.
bool nix::Worker::permanentFailure |
Set if at least one derivation had a BuildError (i.e. permanent failure).
bool nix::Worker::timedOut |
Set if at least one derivation had a timeout.
bool nix::Worker::tryBuildHook = true |
Whether to ask the build hook if it can build a derivation. If it answers with "decline-permanently", we don't try again.