Skip to content

Commit a873a12

Browse files
committed
Avoid custom logic to copy inputs to the remote builder
1 parent 4a4a0f9 commit a873a12

File tree

1 file changed

+7
-43
lines changed

1 file changed

+7
-43
lines changed

src/hydra-queue-runner/build-remote.cc

+7-43
Original file line numberDiff line numberDiff line change
@@ -36,42 +36,6 @@ bool ::Machine::isLocalhost() const
3636

3737
namespace nix::build_remote {
3838

39-
static void copyClosureTo(
40-
::Machine::Connection & conn,
41-
Store & destStore,
42-
const StorePathSet & paths,
43-
SubstituteFlag useSubstitutes = NoSubstitute)
44-
{
45-
StorePathSet closure;
46-
destStore.computeFSClosure(paths, closure);
47-
48-
/* Send the "query valid paths" command with the "lock" option
49-
enabled. This prevents a race where the remote host
50-
garbage-collect paths that are already there. Optionally, ask
51-
the remote host to substitute missing paths. */
52-
// FIXME: substitute output pollutes our build log
53-
/* Get back the set of paths that are already valid on the remote
54-
host. */
55-
auto present = conn.store->queryValidPaths(
56-
closure, true, useSubstitutes);
57-
58-
if (present.size() == closure.size()) return;
59-
60-
auto sorted = destStore.topoSortPaths(closure);
61-
62-
StorePathSet missing;
63-
for (auto i = sorted.rbegin(); i != sorted.rend(); ++i)
64-
if (!present.count(*i)) missing.insert(*i);
65-
66-
printMsg(lvlDebug, "sending %d missing paths", missing.size());
67-
68-
std::unique_lock<std::timed_mutex> sendLock(conn.machine->state->sendLock,
69-
std::chrono::seconds(600));
70-
71-
conn.store->addMultipleToStoreLegacy(destStore, missing);
72-
}
73-
74-
7539
// FIXME: use Store::topoSortPaths().
7640
static StorePaths reverseTopoSortPaths(const std::map<StorePath, UnkeyedValidPathInfo> & paths)
7741
{
@@ -163,13 +127,13 @@ static BasicDerivation sendInputs(
163127
auto now1 = std::chrono::steady_clock::now();
164128

165129
/* Copy the input closure. */
166-
if (conn.machine->isLocalhost()) {
167-
StorePathSet closure;
168-
destStore.computeFSClosure(basicDrv.inputSrcs, closure);
169-
copyPaths(destStore, localStore, closure, NoRepair, NoCheckSigs, NoSubstitute);
170-
} else {
171-
copyClosureTo(conn, destStore, basicDrv.inputSrcs, Substitute);
172-
}
130+
copyClosure(
131+
destStore,
132+
conn.machine->isLocalhost() ? localStore : *conn.store,
133+
basicDrv.inputSrcs,
134+
NoRepair,
135+
NoCheckSigs,
136+
Substitute);
173137

174138
auto now2 = std::chrono::steady_clock::now();
175139

0 commit comments

Comments
 (0)