From e9d0a3a754d5a477126ecb3c0bac3bf91a5bb189 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Mon, 24 Jun 2024 20:25:35 +0200 Subject: [PATCH] Update to latest Lix main --- flake.lock | 16 ++++++++-------- flake.nix | 2 +- src/hydra-eval-jobs/hydra-eval-jobs.cc | 10 +++++----- src/hydra-evaluator/hydra-evaluator.cc | 8 ++++---- src/hydra-queue-runner/build-remote.cc | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/flake.lock b/flake.lock index 0963b0c2..593a3870 100644 --- a/flake.lock +++ b/flake.lock @@ -27,11 +27,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1718081112, - "narHash": "sha256-3cpIVHuyo6yz9n7U/7U/p2Lmwjj1xHdTJR2RkT5JntY=", + "lastModified": 1719211568, + "narHash": "sha256-oIgmvhe3CV/36LC0KXgqWnKXma39wabks8U9JBMDfO4=", "ref": "refs/heads/main", - "rev": "8a3d063a494c4b8c767190a5ce3e4075a75f9d07", - "revCount": 15756, + "rev": "4c3d93611f2848c56ebc69c85f2b1e18001ed3c7", + "revCount": 15877, "type": "git", "url": "https://git@git.lix.systems/lix-project/lix" }, @@ -58,16 +58,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715218190, - "narHash": "sha256-R98WOBHkk8wIi103JUVQF3ei3oui4HvoZcz9tYOAwlk=", + "lastModified": 1719145550, + "narHash": "sha256-K0i/coxxTEl30tgt4oALaylQfxqbotTSNb1/+g+mKMQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9a9960b98418f8c385f52de3b09a63f9c561427a", + "rev": "e4509b3a560c87a8d4cb6f9992b8915abf9e36d8", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 7252a96d..7797e8f4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "A Nix-based continuous build system"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; inputs.nix.url = "git+https://git@git.lix.systems/lix-project/lix"; inputs.nix.inputs.nixpkgs.follows = "nixpkgs"; diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index eb63e0f7..6593edf5 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -349,14 +349,14 @@ int main(int argc, char * * argv) /* Start a handler thread per worker process. */ auto handler = [&]() { - pid_t pid = -1; + Pid pid; try { AutoCloseFD from, to; while (true) { /* Start a new worker process if necessary. */ - if (pid == -1) { + if (!pid) { Pipe toPipe, fromPipe; toPipe.create(); fromPipe.create(); @@ -383,13 +383,13 @@ int main(int argc, char * * argv) }); from = std::move(fromPipe.readSide); to = std::move(toPipe.writeSide); - debug("created worker process %d", pid); + debug("created worker process %d", pid.get()); } /* Check whether the existing worker process is still there. */ auto s = readLine(from.get()); if (s == "restart") { - pid = -1; + pid.wait(); continue; } else if (s != "next") { auto json = nlohmann::json::parse(s); @@ -455,7 +455,7 @@ int main(int argc, char * * argv) } } } catch (...) { - check_pid_status_nonblocking(pid); + check_pid_status_nonblocking(pid.release()); auto state(state_.lock()); state->exc = std::current_exception(); wakeup.notify_all(); diff --git a/src/hydra-evaluator/hydra-evaluator.cc b/src/hydra-evaluator/hydra-evaluator.cc index a99def2a..7a6b140c 100644 --- a/src/hydra-evaluator/hydra-evaluator.cc +++ b/src/hydra-evaluator/hydra-evaluator.cc @@ -191,7 +191,7 @@ struct Evaluator txn.commit(); } - assert(jobset.pid == -1); + assert(jobset.pid); jobset.pid = startProcess([&]() { Strings args = { "hydra-eval-jobset", jobset.name.project, jobset.name.jobset }; @@ -206,7 +206,7 @@ struct Evaluator bool shouldEvaluate(Jobset & jobset) { - if (jobset.pid != -1) { + if (jobset.pid) { // Already running. debug("shouldEvaluate %s? no: already running", jobset.name.display()); @@ -330,7 +330,7 @@ struct Evaluator if (state->runningEvals < maxEvals) { for (auto & i : state->jobsets) - if (i.second.pid == -1 && + if (!i.second.pid && i.second.checkInterval > 0) sleepTime = std::min(sleepTime, std::chrono::seconds( std::max((time_t) 1, i.second.lastCheckedTime - now + i.second.checkInterval))); @@ -407,7 +407,7 @@ struct Evaluator for (auto & i : state->jobsets) { auto & jobset(i.second); - if (jobset.pid == pid) { + if (jobset.pid.get() == pid) { printInfo("evaluation of jobset ā€˜%sā€™ %s", jobset.name.display(), statusToString(status)); diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index 0902700c..ff88b343 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -531,7 +531,7 @@ void State::buildRemote(ref destStore, { auto activeStepState(activeStep->state_.lock()); if (activeStepState->cancelled) throw Error("step cancelled"); - activeStepState->pid = child.sshPid; + activeStepState->pid = child.sshPid.get(); } Finally clearPid([&]() {