File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed
unix/include/nix/store/build Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -456,7 +456,7 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
456
456
fmt (" building '%s'" , worker.store .printStorePath (drvPath));
457
457
#ifndef _WIN32 // TODO enable build hook on Windows
458
458
if (hook)
459
- msg += fmt (" on '%s'" , machineName);
459
+ msg += fmt (" on '%s'" , hook-> machineName );
460
460
#endif
461
461
act = std::make_unique<Activity>(
462
462
*logger,
@@ -466,7 +466,7 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
466
466
Logger::Fields{
467
467
worker.store .printStorePath (drvPath),
468
468
#ifndef _WIN32 // TODO enable build hook on Windows
469
- hook ? machineName :
469
+ hook ? hook-> machineName :
470
470
#endif
471
471
" " ,
472
472
1 ,
@@ -1042,7 +1042,7 @@ HookReply DerivationBuildingGoal::tryBuildHook(
1042
1042
hook = std::move (worker.hook );
1043
1043
1044
1044
try {
1045
- machineName = readLine (hook->fromHook .readSide .get ());
1045
+ hook-> machineName = readLine (hook->fromHook .readSide .get ());
1046
1046
} catch (Error & e) {
1047
1047
e.addTrace ({}, " while reading the machine name from the build hook" );
1048
1048
throw ;
Original file line number Diff line number Diff line change @@ -87,11 +87,6 @@ private:
87
87
88
88
std::map<ActivityId, Activity> builderActivities;
89
89
90
- /* *
91
- * The remote machine on which we're building.
92
- */
93
- std::string machineName;
94
-
95
90
void timedOut (Error && ex) override ;
96
91
97
92
std::string key () override ;
Original file line number Diff line number Diff line change 7
7
8
8
namespace nix {
9
9
10
+ /* *
11
+ * @note Sometimes this is owned by the `Worker`, and sometimes it is
12
+ * owned by a `Goal`. This is for efficency: rather than starting the
13
+ * hook every time we want to ask whether we can run a remote build
14
+ * (which can be very often), we reuse a hook process for answering
15
+ * those queries until it accepts a build. So if there are N
16
+ * derivations to be built, at most N hooks will be started.
17
+ */
10
18
struct HookInstance
11
19
{
12
20
/* *
@@ -29,6 +37,15 @@ struct HookInstance
29
37
*/
30
38
Pid pid;
31
39
40
+ /* *
41
+ * The remote machine on which we're building.
42
+ *
43
+ * @Invariant When the hook instance is owned by the `Worker`, this
44
+ * is the empty string. When it is owned by a `Goal`, this should be
45
+ * set.
46
+ */
47
+ std::string machineName;
48
+
32
49
FdSink sink;
33
50
34
51
std::map<ActivityId, Activity> activities;
You can’t perform that action at this time.
0 commit comments