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 @@ -450,7 +450,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
450
450
fmt (" building '%s'" , worker.store .printStorePath (drvPath));
451
451
#ifndef _WIN32 // TODO enable build hook on Windows
452
452
if (hook)
453
- msg += fmt (" on '%s'" , machineName);
453
+ msg += fmt (" on '%s'" , hook-> machineName );
454
454
#endif
455
455
act = std::make_unique<Activity>(
456
456
*logger,
@@ -460,7 +460,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
460
460
Logger::Fields{
461
461
worker.store .printStorePath (drvPath),
462
462
#ifndef _WIN32 // TODO enable build hook on Windows
463
- hook ? machineName :
463
+ hook ? hook-> machineName :
464
464
#endif
465
465
" " ,
466
466
1 ,
@@ -1027,7 +1027,7 @@ HookReply DerivationBuildingGoal::tryBuildHook()
1027
1027
hook = std::move (worker.hook );
1028
1028
1029
1029
try {
1030
- machineName = readLine (hook->fromHook .readSide .get ());
1030
+ hook-> machineName = readLine (hook->fromHook .readSide .get ());
1031
1031
} catch (Error & e) {
1032
1032
e.addTrace ({}, " while reading the machine name from the build hook" );
1033
1033
throw ;
Original file line number Diff line number Diff line change @@ -95,11 +95,6 @@ private:
95
95
96
96
std::map<ActivityId, Activity> builderActivities;
97
97
98
- /* *
99
- * The remote machine on which we're building.
100
- */
101
- std::string machineName;
102
-
103
98
void timedOut (Error && ex) override ;
104
99
105
100
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