From 524c8fd1507a4dec6a2129cc2f13489c644366f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 10 Nov 2023 14:30:09 +0100 Subject: [PATCH] buildbot-nix: limit evaluation to one job per worker --- buildbot_nix/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index 4dc338a..1abb1d9 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -412,6 +412,7 @@ def nix_eval_config( worker_names: list[str], github_token_secret: str, supported_systems: list[str], + eval_lock: util.WorkerLock, max_memory_size: int = 4096, ) -> util.BuilderConfig: """ @@ -454,6 +455,7 @@ def nix_eval_config( ".#checks", ], haltOnFailure=True, + locks=[eval_lock.access("counting")], ) ) @@ -585,6 +587,7 @@ def config_for_project( github: GithubConfig, nix_supported_systems: list[str], nix_eval_max_memory_size: int, + eval_lock: util.WorkerLock, outputs_path: Path | None = None, ) -> Project: ## get a deterministic jitter for the project @@ -676,6 +679,7 @@ def config_for_project( github_token_secret=github.token_secret_name, supported_systems=nix_supported_systems, max_memory_size=nix_eval_max_memory_size, + eval_lock=eval_lock, ), nix_build_config( project, @@ -739,6 +743,7 @@ class NixConfigurator(ConfiguratorBase): worker_names.append(worker_name) webhook_secret = read_secret_file(self.github.webhook_secret_name) + eval_lock = util.WorkerLock("nix-eval", maxCount=1) for project in projects: create_project_hook( @@ -758,6 +763,7 @@ class NixConfigurator(ConfiguratorBase): self.github, self.nix_supported_systems, self.nix_eval_max_memory_size, + eval_lock, self.outputs_path, )