From ed8698c0c5a21cda420049ff7c022b74be41cf70 Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Thu, 27 Nov 2025 01:04:27 +0000 Subject: [PATCH 01/10] wb | different stop wait times based on the profiling flag --- nix/pkgs.nix | 36 ++++++++++--------- nix/workbench/backend/nomad-job.nix | 1 + nix/workbench/backend/nomad/cloud.nix | 18 +++++++--- nix/workbench/backend/nomad/exec.nix | 16 ++++++--- nix/workbench/backend/runner.nix | 5 ++- nix/workbench/backend/supervisor-conf.nix | 13 +++++++ nix/workbench/backend/supervisor.nix | 4 ++- nix/workbench/default.nix | 42 +++++++++++++---------- nix/workbench/profile/profile.nix | 6 ++-- nix/workbench/shell.nix | 12 +++---- 10 files changed, 97 insertions(+), 56 deletions(-) diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 9e295536b6e..417e416b43c 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -6,33 +6,39 @@ let inherit (final) pkgs; inherit (prev.pkgs) lib; inherit (prev) customConfig; - - # A generic, fully parametric version of the workbench development environment. + # Workbench development environment entrypoint parametrized with current pkgs. workbench = import ./workbench {inherit pkgs lib; inherit (final) cardanoNodePackages cardanoNodeProject;}; - # Workbench runner instantiated by parameters from customConfig: +in with final; +{ + inherit (cardanoNodeProject.args) compiler-nix-name; + + # To make it a flake output so it's available as input to external flakes. + inherit workbench; + + # A workbench runner with default parameters from customConfig. + # Used in flake.nix for "workbench-ci-test" flake output package for CI. workbench-runner = { profileName ? customConfig.localCluster.profileName - , profiling ? customConfig.profiling , backendName ? customConfig.localCluster.backendName , stateDir ? customConfig.localCluster.stateDir , basePort ? customConfig.localCluster.basePort , useCabalRun ? customConfig.localCluster.useCabalRun + , profiling ? customConfig.profiling , batchName ? customConfig.localCluster.batchName , workbenchStartArgs ? customConfig.localCluster.workbenchStartArgs , cardano-node-rev ? null }: workbench.runner - { inherit profileName profiling backendName stateDir basePort useCabalRun; + { # To construct profile attrset with its `materialise-profile` function. + inherit profileName; + # To construct backend attrset with its `materialise-profile` function. + inherit backendName stateDir basePort useCabalRun profiling; + # Parameters for the workbench shell `start-cluster` command. inherit batchName workbenchStartArgs cardano-node-rev; - }; - -in with final; -{ - inherit (cardanoNodeProject.args) compiler-nix-name; - - inherit workbench workbench-runner; + } + ; cabal = haskell-nix.cabal-install.${compiler-nix-name}; @@ -160,15 +166,13 @@ in with final; value = let # Default values only ("run/current", 30000, profiling "none"). - profile = workbench.profile { - inherit profileName; - profiling = "none"; - }; + profile = workbench.profile profileName; backend = workbench.backend { backendName = "nomadcloud"; stateDir = customConfig.localCluster.stateDir; basePort = customConfig.localCluster.basePort; useCabalRun = customConfig.localCluster.useCabalRun; + profiling = "none"; } ; profileBundle = profile.profileBundle diff --git a/nix/workbench/backend/nomad-job.nix b/nix/workbench/backend/nomad-job.nix index 6ee5003c19d..02dfc6ebad3 100644 --- a/nix/workbench/backend/nomad-job.nix +++ b/nix/workbench/backend/nomad-job.nix @@ -739,6 +739,7 @@ let import ./supervisor-conf.nix { inherit pkgs lib stateDir; inherit profile; + profiling = "none"; # Include only this taks' node nodeSpecs = if taskName == "tracer" then {} diff --git a/nix/workbench/backend/nomad/cloud.nix b/nix/workbench/backend/nomad/cloud.nix index e2974b45876..733fae61e6c 100644 --- a/nix/workbench/backend/nomad/cloud.nix +++ b/nix/workbench/backend/nomad/cloud.nix @@ -1,8 +1,9 @@ { pkgs , lib , stateDir -, basePort # Ignored here and just returned to be used by `runner.nix`! -## `useCabalRun` not used here unlike `supervisor.nix`. +, basePort # ignored, just passed to the runner (unlike `supervisor.nix`). +## `useCabalRun` overridden parameter (unlike `supervisor.nix`). +## `profiling` overridden parameter (unlike `supervisor.nix`). , ... }: let @@ -12,9 +13,12 @@ let # genesis files (Buckets needs write permissions for the deployer machine). name = "nomadcloud"; - # Unlike the supervisor backend `useCabalRun` is always false here. + # Unlike the supervisor backend `useCabalRun` is always `false` here. useCabalRun = false; + # Unlike the supervisor backend `profiling` is always `"none"` here. + profiling = "none"; + extraShellPkgs = [ # SRE's patched Nomad 1.6.3 that enables `nix_installables` as artifacts. @@ -58,7 +62,11 @@ in inherit extraShellPkgs; inherit materialise-profile; inherit service-modules; - inherit stateDir basePort; + inherit stateDir; + + # Returns something only to be compatible with what `runner.nix` expects. + inherit basePort; - inherit useCabalRun; + # Ignores the parameters and always returns `false` and `"none"`. + inherit useCabalRun profiling; } diff --git a/nix/workbench/backend/nomad/exec.nix b/nix/workbench/backend/nomad/exec.nix index 62e1b2aff18..b9a01afd7f4 100644 --- a/nix/workbench/backend/nomad/exec.nix +++ b/nix/workbench/backend/nomad/exec.nix @@ -1,8 +1,9 @@ { pkgs , lib , stateDir -, basePort # Ignored here and just returned to be used by `runner.nix`! -## `useCabalRun` not used here unlike `supervisor.nix`. +, basePort # ignored, just passed to the runner (unlike `supervisor.nix`). +## `useCabalRun` overridden parameter (unlike `supervisor.nix`). +## `profiling` overridden parameter (unlike `supervisor.nix`). , ... }: let @@ -15,6 +16,9 @@ let # Unlike the supervisor backend `useCabalRun` is always false here. useCabalRun = false; + # Unlike the supervisor backend `profiling` is always `"none"` here. + profiling = "none"; + extraShellPkgs = [ # SRE's patched Nomad 1.6.3 that enables `nix_installables` as artifacts. @@ -56,7 +60,11 @@ in inherit extraShellPkgs; inherit materialise-profile; inherit service-modules; - inherit stateDir basePort; + inherit stateDir; + + # Returns something only to be compatible with what `runner.nix` expects. + inherit basePort; - inherit useCabalRun; + # Ignores the parameters and always returns `false` and `"none"`. + inherit useCabalRun profiling; } diff --git a/nix/workbench/backend/runner.nix b/nix/workbench/backend/runner.nix index 9a3fed8e706..c27bdfc24da 100644 --- a/nix/workbench/backend/runner.nix +++ b/nix/workbench/backend/runner.nix @@ -18,7 +18,6 @@ let ############################################################################## profileName = profile.name; - inherit (profile) profiling; backendName = backend.name; inherit (backend) stateDir basePort useCabalRun; @@ -278,8 +277,8 @@ let in { - inherit backend; - inherit profiling; + # Don't expose the backend. Just what the shell could need. + inherit (backend) useCabalRun profiling extraShellPkgs; inherit workbench-envars; inherit workbench-interactive-start; diff --git a/nix/workbench/backend/supervisor-conf.nix b/nix/workbench/backend/supervisor-conf.nix index 863f5c02255..7ccc44f16fc 100644 --- a/nix/workbench/backend/supervisor-conf.nix +++ b/nix/workbench/backend/supervisor-conf.nix @@ -2,6 +2,7 @@ , lib , stateDir , profile +, profiling , nodeSpecs , withGenerator , withTracer @@ -140,6 +141,18 @@ let ### - forge-stress-large: 11300000 ### - value: 5000000 (50s more needed) startsecs = 5 + (profile.derived.dataset_measure / (5000000 / 50)); + # The number of seconds to wait for the OS to return a SIGCHLD to + # supervisord after the program has been sent a stopsignal. If this + # number of seconds elapses before supervisord receives a SIGCHLD from + # the process, supervisord will attempt to kill it with a final SIGKILL. + stopwaitsecs = + if profiling == null || profiling == "none" + # Use the default value. + then 10 + # May need a lot of time for a long running node to dump all the + # profiling data. Not risking it. 5 minutes. + else 5*60 + ; }) nodeSpecs)) // diff --git a/nix/workbench/backend/supervisor.nix b/nix/workbench/backend/supervisor.nix index 4d0482d40a7..6538829a979 100644 --- a/nix/workbench/backend/supervisor.nix +++ b/nix/workbench/backend/supervisor.nix @@ -3,6 +3,7 @@ , stateDir , basePort , useCabalRun +, profiling , ... }: with lib; @@ -22,6 +23,7 @@ let supervisorConf = import ./supervisor-conf.nix { inherit pkgs lib stateDir; profile = profileBundle.profile.value; + inherit profiling; nodeSpecs = profileBundle.node-specs.value; withGenerator = true; withTracer = profileBundle.profile.value.node.tracer; @@ -56,5 +58,5 @@ in inherit service-modules; inherit stateDir basePort; - inherit useCabalRun; + inherit useCabalRun profiling; } diff --git a/nix/workbench/default.nix b/nix/workbench/default.nix index f8b3e92e0da..e7e49ac6b1b 100644 --- a/nix/workbench/default.nix +++ b/nix/workbench/default.nix @@ -104,21 +104,18 @@ in pkgs.lib.fix (self: { inherit profile-names-json profile-names; # Return a profile attr with a `materialise-profile` function. - # profileName -> profiling -> profile - profile = - { profileName - , profiling - }: + # profileName -> profile + profile = profileName: (import ./profile/profile.nix { inherit pkgs lib; workbenchNix = self; - inherit profileName profiling; + inherit profileName; } ) ; # Return a backend attr with a `materialise-profile` function. - # backendName -> stateDir -> basePort -> useCabalRun -> backend + # backendName -> stateDir -> basePort -> useCabalRun -> profiling -> backend backend = let backendRegistry = { nomadcloud = params: @@ -132,15 +129,19 @@ in pkgs.lib.fix (self: { , stateDir , basePort , useCabalRun + , profiling }: - # The `useCabalRun` flag is set in the backend to allow the backend to - # override its value. The runner uses the value of `useCabalRun` from - # the backend to prevent a runner using a different value. (backendRegistry."${backendName}") - { inherit pkgs lib stateDir basePort useCabalRun; } + { inherit pkgs lib stateDir basePort; + # The `useCabalRun` and `profiling` flags are set in the backend to + # allow the backend to override its values. The runner must use the + # value of these two flags from the backend to prevent having a runner + # that uses a different value than the ones the backend supports. + inherit useCabalRun profiling; + } ; - # A conveniently-parametrisable workbench preset. + # A conveniently-parametrizable workbench preset. # See https://input-output-hk.github.io/haskell.nix/user-guide/development/ # The general idea is: # 1. profileName -> profiling -> profile @@ -148,23 +149,28 @@ in pkgs.lib.fix (self: { # 3. profile -> backend -> batchName -> runner runner = { profileName - , profiling , backendName , stateDir , basePort , useCabalRun + , profiling , batchName , workbenchStartArgs , cardano-node-rev }: let # Only a name needed to create a profile attrset. - profile = self.profile { inherit profileName profiling; }; - # The `useCabalRun` flag is set in the backend to allow the backend to - # override its value. The runner uses the value of `useCabalRun` from - # the backend to prevent a runner using a different value. + profile = self.profile profileName; backend = self.backend - { inherit backendName stateDir basePort useCabalRun; } + { inherit backendName stateDir basePort; + # The `useCabalRun` and `profiling` flags final decisions + # belong to the backend. We allow the backend to override + # its values. + # The runner must use the values returned from the backend + # to prevent having a runner that uses a different value + # than the ones supported by the chosen backend. + inherit useCabalRun profiling; + } ; in import ./backend/runner.nix { diff --git a/nix/workbench/profile/profile.nix b/nix/workbench/profile/profile.nix index 846b4576039..8c2c3441112 100644 --- a/nix/workbench/profile/profile.nix +++ b/nix/workbench/profile/profile.nix @@ -1,6 +1,7 @@ { pkgs, lib +# The workbench development environment as it was parametrized. , workbenchNix -, profileName, profiling +, profileName }: let @@ -58,7 +59,7 @@ let (pkgs.callPackage ../service/nodes.nix { inherit backend profile nodeSpecs; - inherit profiling; + inherit (backend) profiling; inherit profileJsonPath topologyJsonPath; inherit workbenchNix; ## This ports the (very minimal) config of the deprecated iohk-nix @@ -203,7 +204,6 @@ let in { name = profileName; - inherit profiling; inherit profileJsonPath nodeSpecsJsonPath; inherit profileBundle materialise-profile; } diff --git a/nix/workbench/shell.nix b/nix/workbench/shell.nix index c0b3e7de24f..e7f9698ea43 100644 --- a/nix/workbench/shell.nix +++ b/nix/workbench/shell.nix @@ -17,7 +17,7 @@ project.shellFor { name = "workbench-shell"; shellHook = - let inherit (workbench-runner) backend profiling; + let inherit (workbench-runner) useCabalRun profiling; in '' while test $# -gt 0 @@ -30,7 +30,7 @@ project.shellFor { progress "profile name" $WB_SHELL_PROFILE progress "backend name" $WB_BACKEND progress "deployment name" $WB_DEPLOYMENT_NAME - progress "params" 'useCabalRun=${toString backend.useCabalRun} workbenchDevMode=${toString workbenchDevMode} profiling=${toString profiling}' + progress "params" 'useCabalRun=${toString useCabalRun} workbenchDevMode=${toString workbenchDevMode} profiling=${toString profiling}' progress "WB_SHELL_PROFILE_DATA=" $WB_SHELL_PROFILE_DATA progress "WB_BACKEND_DATA=" $WB_BACKEND_DATA progress "WB_LOCLI_DB=" $WB_LOCLI_DB @@ -52,7 +52,7 @@ project.shellFor { } export -f wb '' - + optionalString backend.useCabalRun + + optionalString useCabalRun '' . nix/workbench/lib-cabal.sh ${optionalString (profiling != "none") "--profiling-${profiling}"} cabal update @@ -120,7 +120,7 @@ project.shellFor { workbench-runner.workbench-interactive-restart ] # Backend dependent packages take precedence. - ++ workbench-runner.backend.extraShellPkgs + ++ workbench-runner.extraShellPkgs ++ [ # Publish bench-data-publish @@ -132,13 +132,13 @@ project.shellFor { ++ lib.optional haveGlibcLocales pkgs.glibcLocales ## Cabal run flag # Include the packages (defined in `lib-cabal.sh`) or the tools to build them. - ++ lib.optionals ( workbench-runner.backend.useCabalRun) [ + ++ lib.optionals ( workbench-runner.useCabalRun) [ cabal-install ghcid haskellBuildUtils pkgs.cabal-plan ] - ++ lib.optionals (!workbench-runner.backend.useCabalRun) [ + ++ lib.optionals (!workbench-runner.useCabalRun) [ cardano-node.passthru.noGitRev cardano-profile cardano-topology From 913bc27917977a4033881120740ac6cb399b845a Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Thu, 27 Nov 2025 17:33:53 +0000 Subject: [PATCH 02/10] wb | add missing heap profiling options and its descriptions --- nix/nixos/cardano-node-service.nix | 34 +++++++++++++--------- nix/workbench/lib-cabal.sh | 16 +++++++---- shell.nix | 46 ++++++++++++++++++++++++++++-- 3 files changed, 75 insertions(+), 21 deletions(-) diff --git a/nix/nixos/cardano-node-service.nix b/nix/nixos/cardano-node-service.nix index 40bfa7b9b78..251f2363b83 100644 --- a/nix/nixos/cardano-node-service.nix +++ b/nix/nixos/cardano-node-service.nix @@ -825,19 +825,27 @@ in { profilingArgs = mkOption { type = listOf str; - default = let commonProfilingArgs = ["--machine-readable" "-tcardano-node.stats" "-pocardano-node"] - ++ optional (cfg.eventlog) "-l"; - in if cfg.profiling == "time" then ["-p"] ++ commonProfilingArgs - else if cfg.profiling == "time-detail" then ["-P"] ++ commonProfilingArgs - else if cfg.profiling == "space" then ["-h"] ++ commonProfilingArgs - else if cfg.profiling == "space-cost" then ["-hc"] ++ commonProfilingArgs - else if cfg.profiling == "space-module" then ["-hm"] ++ commonProfilingArgs - else if cfg.profiling == "space-closure" then ["-hd"] ++ commonProfilingArgs - else if cfg.profiling == "space-type" then ["-hy"] ++ commonProfilingArgs - else if cfg.profiling == "space-retainer" then ["-hr"] ++ commonProfilingArgs - else if cfg.profiling == "space-bio" then ["-hb"] ++ commonProfilingArgs - else if cfg.profiling == "space-heap" then ["-hT"] ++ commonProfilingArgs - else []; + default = + [ "--machine-readable" + "-tcardano-node.stats" + "-pocardano-node" + ] + ++ optional (cfg.eventlog) "-l" + ++ ( + if cfg.profiling == "time" then ["-p"] + else if cfg.profiling == "time-detail" then ["-P"] + else if cfg.profiling == "space" then ["-h"] + else if cfg.profiling == "space-bio" then ["-hb"] + else if cfg.profiling == "space-closure" then ["-hd"] + else if cfg.profiling == "space-cost" then ["-hc"] + else if cfg.profiling == "space-heap" then ["-hT"] + else if cfg.profiling == "space-info" then ["-hi"] + else if cfg.profiling == "space-module" then ["-hm"] + else if cfg.profiling == "space-retainer" then ["-hr"] + else if cfg.profiling == "space-type" then ["-hy"] + else [] + ) + ; description = ''RTS profiling options''; }; diff --git a/nix/workbench/lib-cabal.sh b/nix/workbench/lib-cabal.sh index 8ad4263d14f..8f4ae3835fc 100644 --- a/nix/workbench/lib-cabal.sh +++ b/nix/workbench/lib-cabal.sh @@ -2,12 +2,16 @@ progress "workbench" "cabal-inside-nix-shell mode enabled, calling cardano-* vi while test $# -gt 0 do case "$1" in - --profiling-time ) export WB_PROFILING='time'; WB_RTSARGS=-p;; - --profiling-space ) export WB_PROFILING='space-cost'; WB_RTSARGS=-hc;; - --profiling-heap ) export WB_PROFILING='space-heap'; WB_RTSARGS=-hT;; - --profiling-module ) export WB_PROFILING='space-module'; WB_RTSARGS=-hm;; - --profiling-retainer ) export WB_PROFILING='space-retainer'; WB_RTSARGS=-hr;; - --profiling-type ) export WB_PROFILING='space-type'; WB_RTSARGS=-hy;; + --profiling-time ) export WB_PROFILING='time'; WB_RTSARGS=-p;; + --profiling-time-detail ) export WB_PROFILING='time'; WB_RTSARGS=-P;; + --profiling-bio ) export WB_PROFILING='space-bio'; WB_RTSARGS=-hb;; + --profiling-closure ) export WB_PROFILING='space-closure'; WB_RTSARGS=-hd;; + --profiling-space ) export WB_PROFILING='space-cost'; WB_RTSARGS=-hc;; + --profiling-heap ) export WB_PROFILING='space-heap'; WB_RTSARGS=-hT;; + --profiling-info ) export WB_PROFILING='space-info'; WB_RTSARGS=-hi;; + --profiling-module ) export WB_PROFILING='space-module'; WB_RTSARGS=-hm;; + --profiling-retainer ) export WB_PROFILING='space-retainer'; WB_RTSARGS=-hr;; + --profiling-type ) export WB_PROFILING='space-type'; WB_RTSARGS=-hy;; * ) break;; esac; progress "workbench" "enabling $(red profiling mode): $(white $WB_PROFILING)" shift; done diff --git a/shell.nix b/shell.nix index b13ed965a7d..19843f721e4 100644 --- a/shell.nix +++ b/shell.nix @@ -27,16 +27,58 @@ let profilingEff = if profiling == "none" + # Time and allocation profiling. + ################################ + ### `-p`: produces a standard time profile report. || profiling == "time" + ### `-P`: produces a more detailed report containing the actual time and + ### allocation data as well (not used much.). || profiling == "time-detail" + # RTS options for heap profiling + ################################ + # There are several different kinds of heap profile that can be + # generated. All the different profile types yield a graph of live heap + # against time, but they differ in how the live heap is broken down into + # bands. The following RTS options select which break-down to use: + ### `-hb` (Requires -prof): + ### Breaks down the graph by biography. + || profiling == "space-bio" + ### `-hd` (Requires -prof): + ### Breaks down the graph by closure description. For actual data, the + ### description is just the constructor name, for other closures it is a + ### compiler-generated string identifying the closure. + || profiling == "space-closure" + ### `-hc` (Requires -prof): + ### Breaks down the graph by the cost-centre stack which produced the + ### data. || profiling == "space-cost" + ### `-hT` (This does not require the profiling runtime): + ### Breaks down the graph by heap closure type. || profiling == "space-heap" + ### `-hi` (This does not require the profiling runtime): + ### Break down the graph by the address of the info table of a closure. + ### For this to produce useful output the program must have been compiled + ### with -finfo-table-map but it does not require the profiling runtime. + || profiling == "space-info" + ### `-hm` (Requires -prof). + ### Break down the live heap by the module containing the code which + ### produced the data. || profiling == "space-module" + ### `-hr` (Requires -prof): + ### Break down the graph by retainer set. || profiling == "space-retainer" + ### `-hy` (Requires -prof): + ### Breaks down the graph by type. For closures which have function type + ### or unknown/polymorphic type, the string will represent an + ### approximation to the actual type. || profiling == "space-type" then profiling - else throw "FATAL: WB_PROFILING must be one of: none, time, time-detail, space-cost, space-heap, space-module, space-retainer, space-type"; - project = if profilingEff != "none" then cardanoNodeProject.profiled else cardanoNodeProject; + else throw "FATAL: WB_PROFILING must be one of: none, time, time-detail, space-bio, space-closure, space-cost, space-heap, space-info, space-module, space-retainer, space-type"; + + project = if profilingEff != "none" + then cardanoNodeProject.profiled + else cardanoNodeProject + ; ## The default shell is defined by flake.nix: (cardanoNodeProject = flake.project.${final.system}) inherit (project) shell; From d69487458b9863b0d22deb8389a6c8d24d038a7a Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Thu, 27 Nov 2025 17:34:28 +0000 Subject: [PATCH 03/10] wb | include profiling tools with the profiling workbench shell --- nix/workbench/shell.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nix/workbench/shell.nix b/nix/workbench/shell.nix index e7f9698ea43..72c3af0dee1 100644 --- a/nix/workbench/shell.nix +++ b/nix/workbench/shell.nix @@ -146,6 +146,16 @@ project.shellFor { locli tx-generator.passthru.noGitRev ] + ## When profiling include useful helper programs. + ++ lib.optionals ( workbench-runner.profiling != null + && workbench-runner.profiling != "none" + ) + [ + # For the legacy prog.hp format. + # Which has been deprecated in favour of eventlog based profiling. + hp2pretty hp2html + eventlog2html + ] # Include the workbench as a derivation or use the sources directly ? ++ lib.optionals (!workbenchDevMode) [ workbench.workbench ] ; From a15b1007333980b26fbdfb8482ad267043280467 Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Fri, 28 Nov 2025 23:51:02 +0000 Subject: [PATCH 04/10] wb | remove lib-cabal.sh unused RTS prof params, use nix generated start.sh --- nix/workbench/backend/runner.nix | 3 ++- nix/workbench/lib-cabal.sh | 42 +++++++++++++------------------- nix/workbench/shell.nix | 7 +++--- nix/workbench/wb | 2 +- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/nix/workbench/backend/runner.nix b/nix/workbench/backend/runner.nix index c27bdfc24da..ef65815d39a 100644 --- a/nix/workbench/backend/runner.nix +++ b/nix/workbench/backend/runner.nix @@ -20,7 +20,7 @@ let profileName = profile.name; backendName = backend.name; - inherit (backend) stateDir basePort useCabalRun; + inherit (backend) stateDir basePort useCabalRun profiling; profileBundle = profile.profileBundle { inherit backend; }; @@ -46,6 +46,7 @@ let export WB_SHELL_PROFILE_DATA=${profileDataDir} export WB_BACKEND=${backendName} export WB_BACKEND_DATA=${backendDataDir} + export WB_PROFILING="${profiling}" export WB_CREATE_TESTNET_DATA=''${WB_CREATE_TESTNET_DATA:-1} export WB_DEPLOYMENT_NAME=''${WB_DEPLOYMENT_NAME:-$(basename $(pwd))} export WB_MODULAR_GENESIS=''${WB_MODULAR_GENESIS:-0} diff --git a/nix/workbench/lib-cabal.sh b/nix/workbench/lib-cabal.sh index 8f4ae3835fc..47108d2addf 100644 --- a/nix/workbench/lib-cabal.sh +++ b/nix/workbench/lib-cabal.sh @@ -1,27 +1,20 @@ -progress "workbench" "cabal-inside-nix-shell mode enabled, calling cardano-* via '$(white cabal run)' (instead of using Nix store); $(red lib-cabal.sh) flags: $(yellow $*)" - -while test $# -gt 0 -do case "$1" in - --profiling-time ) export WB_PROFILING='time'; WB_RTSARGS=-p;; - --profiling-time-detail ) export WB_PROFILING='time'; WB_RTSARGS=-P;; - --profiling-bio ) export WB_PROFILING='space-bio'; WB_RTSARGS=-hb;; - --profiling-closure ) export WB_PROFILING='space-closure'; WB_RTSARGS=-hd;; - --profiling-space ) export WB_PROFILING='space-cost'; WB_RTSARGS=-hc;; - --profiling-heap ) export WB_PROFILING='space-heap'; WB_RTSARGS=-hT;; - --profiling-info ) export WB_PROFILING='space-info'; WB_RTSARGS=-hi;; - --profiling-module ) export WB_PROFILING='space-module'; WB_RTSARGS=-hm;; - --profiling-retainer ) export WB_PROFILING='space-retainer'; WB_RTSARGS=-hr;; - --profiling-type ) export WB_PROFILING='space-type'; WB_RTSARGS=-hy;; - * ) break;; esac; - progress "workbench" "enabling $(red profiling mode): $(white $WB_PROFILING)" - shift; done - -if test ! -v WB_PROFILING || test "$WB_PROFILING" = 'none' -then export WB_PROFILING='none' WB_FLAGS_CABAL= -else export WB_FLAGS_CABAL='--enable-profiling --builddir dist-profiled'; fi - -if test ! -v WB_RTSARGS; then export WB_RTSARGS= ; fi -export WB_FLAGS_RTS=${WB_RTSARGS:++RTS $WB_RTSARGS -RTS} +progress "workbench" "cabal-inside-nix-shell mode enabled, calling cardano-* via '$(white cabal run)' (instead of using Nix store); $(red lib-cabal.sh) flags: $(red WB_PROFILING):$(white $WB_PROFILING)" + +# If profiling envar not empty and not "none", we build with profiling. +if test -z "${WB_PROFILING:-}" || test "${WB_PROFILING}" = 'none' +then + export WB_FLAGS_CABAL="" +else + export WB_FLAGS_CABAL='--enable-profiling --builddir dist-profiled' +fi + +# If RTS args envar not empty, append the extra RTS parameters to `cabal run`. +if test -z "${WB_RTSARGS:-}" +then + export WB_FLAGS_RTS= +else + export WB_FLAGS_RTS="+RTS ${WB_RTSARGS} -RTS" +fi WB_TIME=( time @@ -30,7 +23,6 @@ WB_TIME=( ) export WB_NODE_EXECPREFIX="eval ${WB_TIME[*]@Q}" - function workbench-prebuild-executables() { eval $muffle_trace_set_exit diff --git a/nix/workbench/shell.nix b/nix/workbench/shell.nix index 72c3af0dee1..e2cb4cdd949 100644 --- a/nix/workbench/shell.nix +++ b/nix/workbench/shell.nix @@ -17,7 +17,7 @@ project.shellFor { name = "workbench-shell"; shellHook = - let inherit (workbench-runner) useCabalRun profiling; + let inherit (workbench-runner) useCabalRun; in '' while test $# -gt 0 @@ -29,8 +29,9 @@ project.shellFor { progress "profile name" $WB_SHELL_PROFILE progress "backend name" $WB_BACKEND + progress "profiling" $WB_PROFILING + progress "params" 'useCabalRun=${toString useCabalRun} workbenchDevMode=${toString workbenchDevMode}' progress "deployment name" $WB_DEPLOYMENT_NAME - progress "params" 'useCabalRun=${toString useCabalRun} workbenchDevMode=${toString workbenchDevMode} profiling=${toString profiling}' progress "WB_SHELL_PROFILE_DATA=" $WB_SHELL_PROFILE_DATA progress "WB_BACKEND_DATA=" $WB_BACKEND_DATA progress "WB_LOCLI_DB=" $WB_LOCLI_DB @@ -54,7 +55,7 @@ project.shellFor { '' + optionalString useCabalRun '' - . nix/workbench/lib-cabal.sh ${optionalString (profiling != "none") "--profiling-${profiling}"} + . nix/workbench/lib-cabal.sh cabal update '' + diff --git a/nix/workbench/wb b/nix/workbench/wb index 14ff3a7510f..d4d6b9579a2 100755 --- a/nix/workbench/wb +++ b/nix/workbench/wb @@ -209,7 +209,7 @@ start() { esac; shift; done if test -n "$cabal_mode" - then . $(dirname "$0")/lib-cabal.sh ${WB_PROFILING:+--profiling-${WB_PROFILING}} + then . $(dirname "$0")/lib-cabal.sh fi backend validate From 9062bb39aaff61cc5539a0306ce3d74014dc4f42 Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Fri, 28 Nov 2025 23:58:02 +0000 Subject: [PATCH 05/10] wb | remove "-prof" profiles and use WB_PROFILING for everything about profiling --- lib.mk | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/lib.mk b/lib.mk index f0fe8572888..cb8dba66794 100644 --- a/lib.mk +++ b/lib.mk @@ -1,16 +1,16 @@ -## proftgt :: target -> profile -> fullnixmode -> devmode -> autostart -> autostay -> profiled -> backend -> IO () +## proftgt :: target -> profile -> fullnixmode -> devmode -> autostart -> autostay -> backend -> IO () define proftgt $(1): shell $(1): PROFILE = $(2)-${ERA} -$(1): BACKEND = $(8) +$(1): BACKEND = $(7) ifeq ($(strip $(3)),true) $(1): ARGS += --arg 'useCabalRun' false endif ifeq ($(strip $(4)),true) $(1): ARGS += --arg 'workbenchDevMode' true endif -ifeq ($(strip $(7)),true) +ifneq ($(strip $(WB_PROFILING)),) $(1): ARGS += --arg 'profiling' '"$(WB_PROFILING)"' else $(1): ARGS += --arg 'profiling' '"none"' @@ -30,22 +30,18 @@ endef define define_profile_targets ID ?= $(shell git symbolic-ref HEAD | sed 's_/_\n_g' | tail -n1) -## defining this target profname nix dev auto stay profiled backend -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof), $$(prof),false, true,false,false, false, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-prof, $$(prof),false, true,false,false, true, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autoprof, $$(prof),false, true, true,false, true, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-profnix, $$(prof), true, true,false,false, true, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autoprofnix, $$(prof), true, true, true,false, true, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-auto, $$(prof),false, true, true,false, false, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autostay, $$(prof),false, true, true, true, false, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nix, $$(prof), true,false,false,false, false, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonix, $$(prof), true,false, true,false, false, supervisor))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec, $$(prof), true,false,false,false, false, nomadexec))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec-auto, $$(prof), true,false, true,false, false, nomadexec))) +## defining this target profname nix dev auto stay backend +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof), $$(prof),false, true,false,false,supervisor))) +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-auto, $$(prof),false, true, true,false,supervisor))) +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autostay, $$(prof),false, true, true, true,supervisor))) +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nix, $$(prof), true,false,false,false,supervisor))) +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-autonix, $$(prof), true,false, true,false,supervisor))) +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec, $$(prof), true,false,false,false,nomadexec))) +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-nomadexec-auto, $$(prof), true,false, true,false,nomadexec))) endef define define_profile_targets_nomadcloud -## defining this target profname nix dev auto stay profiled backend -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof), $$(prof), true,false,false,false, false, nomadcloud))) -$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-auto, $$(prof), true,false, true,false, false, nomadcloud))) +## defining this target profname nix dev auto stay backend +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof), $$(prof), true,false,false,false,nomadcloud))) +$$(foreach prof,$(1),$$(eval $$(call proftgt,$$(prof)-auto, $$(prof), true,false, true,false,nomadcloud))) endef From 3566fe4526d8f9bca0bc236fdea08ee796f97b1e Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Sat, 29 Nov 2025 00:01:01 +0000 Subject: [PATCH 06/10] wb | always add eventlog RTS param (`-l`) when profiling --- nix/workbench/service/nodes.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nix/workbench/service/nodes.nix b/nix/workbench/service/nodes.nix index 82e1fd6e994..03492e54ed6 100644 --- a/nix/workbench/service/nodes.nix +++ b/nix/workbench/service/nodes.nix @@ -149,6 +149,8 @@ let ]; } // optionalAttrs (profiling != "none") { inherit profiling; + # Always add the `-l` RTS param with profiling. + eventlog = true; } // optionalAttrs (profiling == "none") { # Switch to `noGitRev` to avoid rebuilding with every commit. package = pkgs.cardano-node.passthru.noGitRev; From 7d40b4a9087a0dff7b099c799de6b2dd3ec9a8eb Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Mon, 1 Dec 2025 11:46:50 +0000 Subject: [PATCH 07/10] wb | make only cardano-node, cardano-tracer, tx-generator and locli support profiling --- nix/workbench/lib-cabal.sh | 43 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/nix/workbench/lib-cabal.sh b/nix/workbench/lib-cabal.sh index 47108d2addf..a2a556a7bdd 100644 --- a/nix/workbench/lib-cabal.sh +++ b/nix/workbench/lib-cabal.sh @@ -33,45 +33,46 @@ function workbench-prebuild-executables() newline unset NIX_ENFORCE_PURITY - for exe in cardano-node cardano-profile cardano-topology cardano-tracer tx-generator locli + # Executables with profiling support. + for exe in cardano-node cardano-tracer tx-generator locli do echo "workbench: $(blue prebuilding) $(red $exe)" - verbose "exec" "cabal build ${WB_FLAGS_CABAL} -- exe:$exe" - cabal $(test -z "${verbose:-}" && echo '-v0') build ${WB_FLAGS_CABAL} -- exe:$exe || return 1 + verbose "exec" "cabal build ${WB_FLAGS_CABAL} -- exe:$exe" + cabal $(test -z "${verbose:-}" && echo '-v0') build ${WB_FLAGS_CABAL} -- exe:$exe || return 1 + done + # Executables without profiling support. + for exe in cardano-profile cardano-topology + do echo "workbench: $(blue prebuilding) $(red $exe)" + verbose "exec" "cabal build -- exe:$exe" + cabal $(test -z "${verbose:-}" && echo '-v0') build -- exe:$exe || return 1 done echo eval $restore_trace } function cardano-node() { - ${WB_NODE_EXECPREFIX} cabal -v0 run ${WB_FLAGS_CABAL} exe:cardano-node -- ${WB_FLAGS_RTS} "$@" + ${WB_NODE_EXECPREFIX} cabal -v0 run ${WB_FLAGS_CABAL} exe:cardano-node -- ${WB_FLAGS_RTS} "$@" } -function cardano-profile() { - cabal -v0 run ${WB_FLAGS_CABAL} exe:cardano-profile -- ${WB_FLAGS_RTS} "$@" +function cardano-tracer() { + ${WB_NODE_EXECPREFIX} cabal -v0 run ${WB_FLAGS_CABAL} exe:cardano-tracer -- ${WB_FLAGS_RTS} "$@" } -function cardano-topology() { - cabal -v0 run ${WB_FLAGS_CABAL} exe:cardano-topology -- ${WB_FLAGS_RTS} "$@" +function locli() { + ${WB_NODE_EXECPREFIX} cabal -v0 run ${WB_FLAGS_CABAL} exe:locli -- ${WB_FLAGS_RTS} "$@" } -function cardano-tracer() { - cabal -v0 run ${WB_FLAGS_CABAL} exe:cardano-tracer -- ${WB_FLAGS_RTS} "$@" +function tx-generator() { + ${WB_NODE_EXECPREFIX} cabal -v0 run ${WB_FLAGS_CABAL} exe:tx-generator -- ${WB_FLAGS_RTS} "$@" } -function locli() { - #cabal -v0 build ${WB_FLAGS_CABAL} exe:locli - #set-git-rev \ - # $(git rev-parse HEAD) \ - # $(cabal list-bin locli) || true - # cabal -v0 exec ${WB_FLAGS_CABAL} locli -- ${WB_FLAGS_RTS} "$@" - - cabal -v0 run ${WB_FLAGS_CABAL} exe:locli -- ${WB_FLAGS_RTS} "$@" +function cardano-profile() { + cabal -v0 run exe:cardano-profile "$@" } -function tx-generator() { - cabal -v0 run ${WB_FLAGS_CABAL} exe:tx-generator -- ${WB_FLAGS_RTS} "$@" +function cardano-topology() { + cabal -v0 run exe:cardano-topology "$@" } export WB_MODE_CABAL=t -export -f cardano-node cardano-profile cardano-topology cardano-tracer locli tx-generator +export -f cardano-node cardano-tracer locli tx-generator cardano-profile cardano-topology From 261574ceccaed0a92587a78c0e2d5ddd0d7baf05 Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Fri, 5 Dec 2025 01:15:10 +0000 Subject: [PATCH 08/10] wb | obtain all dependencies from the same, maybe custom, haskell.nix project --- nix/pkgs.nix | 7 +- nix/workbench/backend/nomad.nix | 17 ++-- nix/workbench/backend/nomad/cloud.nix | 5 +- nix/workbench/backend/nomad/exec.nix | 5 +- nix/workbench/backend/runner.nix | 18 ++-- nix/workbench/backend/supervisor.nix | 1 + nix/workbench/default.nix | 27 ++++-- nix/workbench/profile/profile.nix | 42 +++++---- nix/workbench/service/generator.nix | 12 +-- nix/workbench/service/healthcheck.nix | 15 ++-- nix/workbench/service/nodes.nix | 12 +-- nix/workbench/service/tracer.nix | 9 +- nix/workbench/shell.nix | 110 +++++++++++++---------- nix/workbench/workload/cgroup_memory.nix | 1 + nix/workbench/workload/latency.nix | 1 + nix/workbench/workload/voting.nix | 3 +- 16 files changed, 176 insertions(+), 109 deletions(-) diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 417e416b43c..78c90521571 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -6,9 +6,12 @@ let inherit (final) pkgs; inherit (prev.pkgs) lib; inherit (prev) customConfig; - # Workbench development environment entrypoint parametrized with current pkgs. + # Parametrized helper entrypoint for the workbench development environment. workbench = import ./workbench - {inherit pkgs lib; inherit (final) cardanoNodePackages cardanoNodeProject;}; + { inherit pkgs lib; + haskellProject = final.cardanoNodeProject; + } + ; in with final; { diff --git a/nix/workbench/backend/nomad.nix b/nix/workbench/backend/nomad.nix index ff8ca9baf02..233b7e02b68 100644 --- a/nix/workbench/backend/nomad.nix +++ b/nix/workbench/backend/nomad.nix @@ -1,5 +1,6 @@ { pkgs , lib +, haskellProject , stateDir , subBackendName , ... @@ -145,29 +146,33 @@ let # the one used to enter the shell. cardano-node = rec { # Local reference only used if not "cloud". - # Avoid rebuilding on every commit because of `set-git-rev`. - nix-store-path = pkgs.cardanoNodePackages.cardano-node.passthru.noGitRev; + nix-store-path = haskellProject.exes.cardano-node; flake-reference = "github:intersectmbo/cardano-node"; + # Where to fetch the binary from during "cloud" runs. + # Avoid nix cache misses on every commit because of `set-git-rev`. flake-output = "cardanoNodePackages.cardano-node.passthru.noGitRev" ; }; cardano-cli = rec { # Local reference only used if not "cloud". - # Avoid rebuilding on every commit because of `set-git-rev`. - nix-store-path = pkgs.cardanoNodePackages.cardano-cli.passthru.noGitRev; + nix-store-path = haskellProject.hsPkgs.cardano-cli.components.exes.cardano-cli; flake-reference = "github:input-output-hk/cardano-cli"; + # Where to fetch the binary from during "cloud" runs. + # Avoid nix cache misses on every commit because of `set-git-rev`. flake-output = "cardanoNodePackages.cardano-cli.passthru.noGitRev"; }; cardano-tracer = rec { # Local reference only used if not "cloud". - nix-store-path = pkgs.cardanoNodePackages.cardano-tracer; + nix-store-path = haskellProject.exes.cardano-tracer; flake-reference = "github:intersectmbo/cardano-node"; flake-output = "cardanoNodePackages.cardano-tracer"; }; tx-generator = rec { # Local reference only used if not "cloud". - nix-store-path = pkgs.cardanoNodePackages.tx-generator.passthru.noGitRev; + nix-store-path = haskellProject.exes.tx-generator; flake-reference = "github:intersectmbo/cardano-node"; + # Where to fetch the binary from during "cloud" runs. + # Avoid nix cache misses on every commit because of `set-git-rev`. flake-output = "cardanoNodePackages.tx-generator.passthru.noGitRev"; }; } diff --git a/nix/workbench/backend/nomad/cloud.nix b/nix/workbench/backend/nomad/cloud.nix index 733fae61e6c..c29b4263bc1 100644 --- a/nix/workbench/backend/nomad/cloud.nix +++ b/nix/workbench/backend/nomad/cloud.nix @@ -1,5 +1,6 @@ { pkgs , lib +, haskellProject , stateDir , basePort # ignored, just passed to the runner (unlike `supervisor.nix`). ## `useCabalRun` overridden parameter (unlike `supervisor.nix`). @@ -39,7 +40,9 @@ let # Build a Nomad Job specification for this Nomad "sub-backend". materialise-profile = let params = { - inherit pkgs lib stateDir; + inherit pkgs lib; + inherit haskellProject; + inherit stateDir; subBackendName = "cloud"; }; in (import ../nomad.nix params).materialise-profile diff --git a/nix/workbench/backend/nomad/exec.nix b/nix/workbench/backend/nomad/exec.nix index b9a01afd7f4..8c4208286a3 100644 --- a/nix/workbench/backend/nomad/exec.nix +++ b/nix/workbench/backend/nomad/exec.nix @@ -1,5 +1,6 @@ { pkgs , lib +, haskellProject , stateDir , basePort # ignored, just passed to the runner (unlike `supervisor.nix`). ## `useCabalRun` overridden parameter (unlike `supervisor.nix`). @@ -37,7 +38,9 @@ let # Build a Nomad Job specification for this Nomad "sub-backend". materialise-profile = let params = { - inherit pkgs lib stateDir; + inherit pkgs lib; + inherit haskellProject; + inherit stateDir; subBackendName = "exec"; }; in (import ../nomad.nix params).materialise-profile diff --git a/nix/workbench/backend/runner.nix b/nix/workbench/backend/runner.nix index ef65815d39a..e539efd3008 100644 --- a/nix/workbench/backend/runner.nix +++ b/nix/workbench/backend/runner.nix @@ -1,7 +1,6 @@ { pkgs, lib ## The binaries/scripts to use when calling the workbench. -, cardanoNodeProject -, cardanoNodePackages +, haskellProject , workbench # The derivation. ## Profile dependent parameters. , profile @@ -33,9 +32,9 @@ let cacheDir = "${__getEnv "HOME"}/.cache/cardano-workbench"; # recover CHaP location from cardano's project - chap = cardanoNodeProject.args.inputMap."https://chap.intersectmbo.org/"; + chap = haskellProject.args.inputMap."https://chap.intersectmbo.org/"; # build plan as computed by nix - nixPlanJson = cardanoNodeProject.plan-nix + "/plan.json"; + nixPlanJson = haskellProject.plan-nix + "/plan.json"; # Optimize cache hits setting gitrev using bash once inside the shell. workbench-envars = @@ -122,12 +121,9 @@ let ] ) ++ - (with cardanoNodePackages; - [ - cardano-cli - locli - ] - ) + [ haskellProject.exes.locli + haskellProject.hsPkgs.cardano-cli.components.exes.cardano-cli + ] ; workbench-profile-run = @@ -200,7 +196,7 @@ let --genesis-cache-entry ${genesisFiles} --batch-name smoke-test --base-port ${toString basePort} - --node-source ${pkgs.cardanoNodeProject.args.src} + --node-source ${haskellProject.args.src} --node-rev ${cardano-node-rev} --cache-dir ./cache ${__concatStringsSep " " workbenchStartArgs} diff --git a/nix/workbench/backend/supervisor.nix b/nix/workbench/backend/supervisor.nix index 6538829a979..76b4839b1fd 100644 --- a/nix/workbench/backend/supervisor.nix +++ b/nix/workbench/backend/supervisor.nix @@ -1,5 +1,6 @@ { pkgs , lib +, haskellProject , stateDir , basePort , useCabalRun diff --git a/nix/workbench/default.nix b/nix/workbench/default.nix index e7e49ac6b1b..6f0c314085d 100644 --- a/nix/workbench/default.nix +++ b/nix/workbench/default.nix @@ -1,6 +1,17 @@ +# The workbench entrypoint, { pkgs, lib -, cardanoNodeProject -, cardanoNodePackages + # This provided project attrset will be used all over the workbench instead + # of the flake's `pkgs` or `cardanoNodePackages`. This allows to easily + # parametrize the whole build at any point, be it only for the workbench in + # "nix/pkgs.nix" or when entering a workbench shell in + # "nix/workbench/shell.nix". + # Also, by using a haskell.nix project instead of `cardanoNodePackages` or + # `pkgs` to fetch it's project related dependencies we are sure they are not + # tagged with the git commit because if we use the `set-git-rev` versions of + # `cardano-node` and/or `tx-generator` then on every distinct commit ID all + # the scripts generated by the workbench (start.sh files) will be re-generated + # instead of obtained from the cache in the nix store. +, haskellProject }: with lib; @@ -51,7 +62,7 @@ let ) # Include only the extensions defined above. (lib.any id - (attrValues (mapAttrs + (lib.attrValues (mapAttrs (dirName: suffixes: (lib.hasPrefix (dirName + "/") relativePath) && @@ -90,7 +101,7 @@ let profile-names-json = pkgs.runCommand "profile-names.json" {} '' - ${cardanoNodePackages.cardano-profile}/bin/cardano-profile "names" > $out + ${haskellProject.exes.cardano-profile}/bin/cardano-profile "names" > $out '' ; @@ -99,8 +110,8 @@ let in pkgs.lib.fix (self: { - inherit cardanoNodePackages; inherit workbench; + inherit haskellProject; inherit profile-names-json profile-names; # Return a profile attr with a `materialise-profile` function. @@ -132,7 +143,9 @@ in pkgs.lib.fix (self: { , profiling }: (backendRegistry."${backendName}") - { inherit pkgs lib stateDir basePort; + { inherit pkgs lib; + inherit haskellProject; + inherit stateDir basePort; # The `useCabalRun` and `profiling` flags are set in the backend to # allow the backend to override its values. The runner must use the # value of these two flags from the backend to prevent having a runner @@ -175,7 +188,7 @@ in pkgs.lib.fix (self: { in import ./backend/runner.nix { inherit pkgs lib; - inherit cardanoNodeProject cardanoNodePackages; + inherit haskellProject; inherit workbench; inherit profile backend; inherit batchName workbenchStartArgs; diff --git a/nix/workbench/profile/profile.nix b/nix/workbench/profile/profile.nix index 8c2c3441112..9bbef04d777 100644 --- a/nix/workbench/profile/profile.nix +++ b/nix/workbench/profile/profile.nix @@ -1,5 +1,5 @@ { pkgs, lib -# The workbench development environment as it was parametrized. +# The workbench attrset as it was parametrized. , workbenchNix , profileName }: @@ -19,8 +19,8 @@ let moreutils # sponge jq graphviz - workbenchNix.cardanoNodePackages.cardano-profile - workbenchNix.cardanoNodePackages.cardano-topology + workbenchNix.haskellProject.exes.cardano-profile + workbenchNix.haskellProject.exes.cardano-topology ]; } '' @@ -56,12 +56,13 @@ let profile = __fromJSON (__readFile profileJsonPath); nodeSpecs = __fromJSON (__readFile nodeSpecsJsonPath); inherit - (pkgs.callPackage + (import ../service/nodes.nix - { inherit backend profile nodeSpecs; + { inherit pkgs; + inherit workbenchNix; + inherit backend profile nodeSpecs; inherit (backend) profiling; inherit profileJsonPath topologyJsonPath; - inherit workbenchNix; ## This ports the (very minimal) config of the deprecated iohk-nix ## testnet environment to workbench, removing the dependency on it. baseNodeConfig = @@ -72,16 +73,18 @@ let LastKnownBlockVersion-Alt = 0; } // - workbenchNix.cardanoNodePackages.cardanoLib.defaultLogConfig + workbenchNix.haskellProject.pkgs.cardanoLib.defaultLogConfig ; } ) node-services ; inherit - (pkgs.callPackage + (import ../service/generator.nix - { inherit backend profile nodeSpecs; + { inherit pkgs; + inherit (workbenchNix) haskellProject; + inherit backend profile nodeSpecs; inherit node-services; } ) @@ -93,7 +96,10 @@ let start = '' ${import ../workload/${name}.nix - {inherit pkgs profile nodeSpecs workload;} + { inherit pkgs; + inherit (workbenchNix) haskellProject; + inherit profile nodeSpecs workload; + } } ${workload.entrypoints.producers} '' @@ -102,16 +108,22 @@ let profile.workloads ; inherit - (pkgs.callPackage + (import ../service/tracer.nix - {inherit backend profile nodeSpecs;} + { inherit pkgs; + inherit (workbenchNix) haskellProject; + inherit backend profile nodeSpecs; + } ) tracer-service ; healthcheck-service = - (pkgs.callPackage + (import ../service/healthcheck.nix - {inherit backend profile nodeSpecs;} + { inherit pkgs; + inherit (workbenchNix) haskellProject; + inherit backend profile nodeSpecs; + } ) ; in { @@ -146,7 +158,7 @@ let inherit topologyJsonPath topologyDotPath; inherit nodeSpecsJsonPath; nodeServices = __toJSON - (lib.mapAttrs + (pkgs.lib.mapAttrs (name: node-service: { inherit name; inherit (node-service) start config; diff --git a/nix/workbench/service/generator.nix b/nix/workbench/service/generator.nix index a595c8ca52e..2f4a294edc3 100644 --- a/nix/workbench/service/generator.nix +++ b/nix/workbench/service/generator.nix @@ -1,5 +1,5 @@ { pkgs - +, haskellProject , backend , profile , nodeSpecs @@ -57,11 +57,13 @@ let ; } // optionalAttrs profile.node.tracer { tracerSocketPath = "../tracer/tracer.socket"; + # Decide where the executable comes from: + ######################################### } // optionalAttrs (!backend.useCabalRun) { - # Use to `noGitRev` to avoid rebuilding on every commit. - executable = "${pkgs.cardanoNodePackages.tx-generator.passthru.noGitRev}/bin/tx-generator"; - } // optionalAttrs backend.useCabalRun { + executable = "${haskellProject.exes.tx-generator}/bin/tx-generator"; + } // optionalAttrs backend.useCabalRun { executable = "tx-generator"; + ######################################### }); ## @@ -169,7 +171,7 @@ let then '' ${import ../workload/${workload_name}.nix - {inherit pkgs profile nodeSpecs workload;} + {inherit pkgs haskellProject profile nodeSpecs workload;} } (cd ../workloads/${workload_name} && ${entrypoint} ${node_name}) '' diff --git a/nix/workbench/service/healthcheck.nix b/nix/workbench/service/healthcheck.nix index 27dac71a0bd..d06fbf93fe3 100644 --- a/nix/workbench/service/healthcheck.nix +++ b/nix/workbench/service/healthcheck.nix @@ -1,4 +1,5 @@ { pkgs +, haskellProject , backend , profile , nodeSpecs @@ -12,17 +13,19 @@ let supervisor = pkgs.supervisor; grep = pkgs.gnugrep; jq = pkgs.jq; - # Avoid rebuilding the script on every commit. - # `noGitRev` does not have `set-git-rev` that is set on every commit. - cardano-node = with pkgs; + # Decide where the executables come from: + ######################################### + cardano-node = if backend.useCabalRun then "cardano-node" - else cardanoNodePackages.cardano-node.passthru.noGitRev + "/bin/cardano-node" + else haskellProject.exes.cardano-node + "/bin/cardano-node" ; - cardano-cli = with pkgs; + cardano-cli = if backend.useCabalRun then "cardano-cli" - else cardanoNodePackages.cardano-cli.passthru.noGitRev + "/bin/cardano-cli"; + else haskellProject.hsPkgs.cardano-cli.components.exes.cardano-cli + "/bin/cardano-cli" + ; + ######################################### in { start = # Assumptions: diff --git a/nix/workbench/service/nodes.nix b/nix/workbench/service/nodes.nix index 03492e54ed6..37e5011124c 100644 --- a/nix/workbench/service/nodes.nix +++ b/nix/workbench/service/nodes.nix @@ -151,12 +151,14 @@ let inherit profiling; # Always add the `-l` RTS param with profiling. eventlog = true; - } // optionalAttrs (profiling == "none") { - # Switch to `noGitRev` to avoid rebuilding with every commit. - package = pkgs.cardano-node.passthru.noGitRev; - } // optionalAttrs backend.useCabalRun { + # Decide where the executable comes from: + ######################################### + } // optionalAttrs (!backend.useCabalRun) { + package = workbenchNix.haskellProject.exes.cardano-node; + } // optionalAttrs backend.useCabalRun { # Allow the shell function to take precedence. executable = "cardano-node"; + ######################################### } // optionalAttrs isProducer { operationalCertificate = "../genesis/node-keys/node${toString i}.opcert"; kesKey = "../genesis/node-keys/node-kes${toString i}.skey"; @@ -225,7 +227,7 @@ let # A workbench with only the dependencies needed for this command. [ workbenchNix.workbench jq - workbenchNix.cardanoNodePackages.cardano-topology + workbenchNix.haskellProject.exes.cardano-topology ]; } '' diff --git a/nix/workbench/service/tracer.nix b/nix/workbench/service/tracer.nix index 7076483c091..cfbf1c1bec3 100644 --- a/nix/workbench/service/tracer.nix +++ b/nix/workbench/service/tracer.nix @@ -1,5 +1,5 @@ { pkgs - +, haskellProject , backend , profile , nodeSpecs @@ -27,8 +27,13 @@ let networkMagic = profile.genesis.network_magic; configFile = "config.json"; metricsHelp = "../../../cardano-tracer/configuration/metrics_help.json"; - } // optionalAttrs backend.useCabalRun { + # Decide where the executable comes from: + ######################################### + } // optionalAttrs (!backend.useCabalRun) { + executable = "${haskellProject.exes.cardano-tracer}/bin/cardano-tracer"; + } // optionalAttrs backend.useCabalRun { executable = "cardano-tracer"; + ######################################### } // optionalAttrs profile.tracer.rtview { RTView = { epHost = "127.0.0.1"; diff --git a/nix/workbench/shell.nix b/nix/workbench/shell.nix index e2cb4cdd949..efe404f00cb 100644 --- a/nix/workbench/shell.nix +++ b/nix/workbench/shell.nix @@ -95,58 +95,73 @@ project.shellFor { }; # These programs will be available inside the nix-shell. - nativeBuildInputs = with pkgs; with haskellPackages; with cardanoNodePackages; [ - db-analyser - cardano-cli.passthru.noGitRev - pkgs.graphviz - graphmod - jq - weeder - nix - (pkgs.pkg-config or pkgconfig) - pkgs.profiteur - profiterole - ghc-prof-flamegraph - sqlite-interactive - tmux - pkgs.cairo - pkgs.dyff - pkgs.git - pkgs.hlint - pkgs.moreutils - pkgs.time - pkgs.util-linux - workbench-runner.workbench-interactive-start - workbench-runner.workbench-interactive-stop - workbench-runner.workbench-interactive-restart - ] + nativeBuildInputs = + (with pkgs; [ + cairo + dyff + em # Performance report generation + git + graphviz + hlint + jq + moreutils + nix + (pkgs.pkg-config or pkgconfig) + profiteur + sqlite-interactive + time + tmux + util-linux + ]) + ++ (with pkgs.haskellPackages; [ + ghc-prof-flamegraph + graphmod + profiterole + weeder + ]) + ++ + ## Cabal run flag: + # Include the packages or the tools to build them (see `lib-cabal.sh`). + (if !workbench-runner.useCabalRun + then + (with project.exes; [ + # A `notGitRev` version, faster to enter a workbench after a new commit. + cardano-node + cardano-profile + cardano-topology + cardano-tracer + locli + # A `notGitRev` version, faster to enter a workbench after a new commit. + tx-generator + ]) + else + (with pkgs; [ + pkgs.cabal-install + pkgs.ghcid + pkgs.haskellBuildUtils + pkgs.cabal-plan + ]) + ) + ++ (with project.hsPkgs; [ + # A `notGitRev` version, faster to enter a workbench after a new commit. + cardano-cli.components.exes.cardano-cli + ouroboros-consensus-cardano.components.exes.db-analyser + ]) + ++ (with workbench-runner; [ + workbench-interactive-start + workbench-interactive-stop + workbench-interactive-restart + ]) # Backend dependent packages take precedence. ++ workbench-runner.extraShellPkgs ++ [ # Publish - bench-data-publish + pkgs.bench-data-publish # Debugging - postgresql - # Performance report generation - em + pkgs.postgresql ] ++ lib.optional haveGlibcLocales pkgs.glibcLocales - ## Cabal run flag - # Include the packages (defined in `lib-cabal.sh`) or the tools to build them. - ++ lib.optionals ( workbench-runner.useCabalRun) [ - cabal-install - ghcid - haskellBuildUtils - pkgs.cabal-plan - ] - ++ lib.optionals (!workbench-runner.useCabalRun) [ - cardano-node.passthru.noGitRev - cardano-profile - cardano-topology - cardano-tracer - locli - tx-generator.passthru.noGitRev - ] + ## When profiling include useful helper programs. ++ lib.optionals ( workbench-runner.profiling != null && workbench-runner.profiling != "none" @@ -154,8 +169,9 @@ project.shellFor { [ # For the legacy prog.hp format. # Which has been deprecated in favour of eventlog based profiling. - hp2pretty hp2html - eventlog2html + pkgs.haskellPackages.hp2pretty + pkgs.haskellPackages.hp2html + pkgs.haskellPackages.eventlog2html ] # Include the workbench as a derivation or use the sources directly ? ++ lib.optionals (!workbenchDevMode) [ workbench.workbench ] diff --git a/nix/workbench/workload/cgroup_memory.nix b/nix/workbench/workload/cgroup_memory.nix index b8e9b60c3e2..b92bb6416eb 100644 --- a/nix/workbench/workload/cgroup_memory.nix +++ b/nix/workbench/workload/cgroup_memory.nix @@ -1,4 +1,5 @@ { pkgs +, haskellProject , profile , nodeSpecs , workload diff --git a/nix/workbench/workload/latency.nix b/nix/workbench/workload/latency.nix index 70be055d360..5c2d2bbba2e 100644 --- a/nix/workbench/workload/latency.nix +++ b/nix/workbench/workload/latency.nix @@ -1,4 +1,5 @@ { pkgs +, haskellProject , profile , nodeSpecs , workload diff --git a/nix/workbench/workload/voting.nix b/nix/workbench/workload/voting.nix index 922ccc7bb2d..b68f0c885cd 100644 --- a/nix/workbench/workload/voting.nix +++ b/nix/workbench/workload/voting.nix @@ -1,4 +1,5 @@ { pkgs +, haskellProject , profile , nodeSpecs , workload @@ -13,7 +14,7 @@ let coreutils = pkgs.coreutils; jq = pkgs.jq; # Avoid rebuilding on every commit because of `set-git-rev`. - cardano-cli = pkgs.cardanoNodePackages.cardano-cli.passthru.noGitRev; + cardano-cli = haskellProject.hsPkgs.cardano-cli.components.exes.cardano-cli; # Script params! ################ From 49192f801c85c64f1b8f4067899bf1f0521377cd Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Fri, 5 Dec 2025 01:59:34 +0000 Subject: [PATCH 09/10] wb | do not pass around both `pkgs` and `lib` --- nix/pkgs.nix | 2 +- nix/workbench/backend/nomad-job.nix | 5 +++-- nix/workbench/backend/nomad.nix | 11 ++++++----- nix/workbench/backend/nomad/cloud.nix | 3 +-- nix/workbench/backend/nomad/exec.nix | 3 +-- nix/workbench/backend/runner.nix | 4 ++-- nix/workbench/backend/supervisor-conf.nix | 8 ++++---- nix/workbench/backend/supervisor.nix | 5 ++--- nix/workbench/default.nix | 20 ++++++++++---------- nix/workbench/profile/profile.nix | 2 +- 10 files changed, 31 insertions(+), 32 deletions(-) diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 78c90521571..14da52dbb24 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -8,7 +8,7 @@ let inherit (prev) customConfig; # Parametrized helper entrypoint for the workbench development environment. workbench = import ./workbench - { inherit pkgs lib; + { inherit pkgs; haskellProject = final.cardanoNodeProject; } ; diff --git a/nix/workbench/backend/nomad-job.nix b/nix/workbench/backend/nomad-job.nix index 02dfc6ebad3..d859ec62030 100644 --- a/nix/workbench/backend/nomad-job.nix +++ b/nix/workbench/backend/nomad-job.nix @@ -4,7 +4,6 @@ # To make it easier to improve and debug the almighty workbench! ################################################################################ { pkgs -, lib , stateDir , profileBundle , generatorTaskName @@ -15,6 +14,8 @@ let + inherit (pkgs) lib; + profile = profileBundle.profile.value; # Filesystem @@ -737,7 +738,7 @@ let destination = "local/${task_supervisord_conf}"; data = escapeTemplate ( import ./supervisor-conf.nix - { inherit pkgs lib stateDir; + { inherit pkgs stateDir; inherit profile; profiling = "none"; # Include only this taks' node diff --git a/nix/workbench/backend/nomad.nix b/nix/workbench/backend/nomad.nix index 233b7e02b68..9b272b86b29 100644 --- a/nix/workbench/backend/nomad.nix +++ b/nix/workbench/backend/nomad.nix @@ -1,5 +1,4 @@ { pkgs -, lib , haskellProject , stateDir , subBackendName @@ -7,6 +6,8 @@ }: let + inherit (pkgs) lib; + # Backend-specific Nix bits: materialise-profile = { profileBundle }: # Intermediate / workbench-adhoc container specifications @@ -192,7 +193,7 @@ let exec = { # TODO: oneTracerPerGroup oneTracerPerCluster = import ./nomad-job.nix - { inherit pkgs lib stateDir; + { inherit pkgs stateDir; inherit profileBundle; inherit generatorTaskName; inherit installables; @@ -200,7 +201,7 @@ let withSsh = false; }; oneTracerPerNode = import ./nomad-job.nix - { inherit pkgs lib stateDir; + { inherit pkgs stateDir; inherit profileBundle; inherit generatorTaskName; inherit installables; @@ -215,7 +216,7 @@ let # Always "oneTracerPerNode" # TODO: oneTracerPerCluster and oneTracerPerGroup nomadExec = import ./nomad-job.nix - { inherit pkgs lib stateDir; + { inherit pkgs stateDir; inherit profileBundle; inherit generatorTaskName; inherit installables; @@ -223,7 +224,7 @@ let withSsh = false; }; ssh = import ./nomad-job.nix - { inherit pkgs lib stateDir; + { inherit pkgs stateDir; inherit profileBundle; inherit generatorTaskName; inherit installables; diff --git a/nix/workbench/backend/nomad/cloud.nix b/nix/workbench/backend/nomad/cloud.nix index c29b4263bc1..116a2f4f529 100644 --- a/nix/workbench/backend/nomad/cloud.nix +++ b/nix/workbench/backend/nomad/cloud.nix @@ -1,5 +1,4 @@ { pkgs -, lib , haskellProject , stateDir , basePort # ignored, just passed to the runner (unlike `supervisor.nix`). @@ -40,7 +39,7 @@ let # Build a Nomad Job specification for this Nomad "sub-backend". materialise-profile = let params = { - inherit pkgs lib; + inherit pkgs; inherit haskellProject; inherit stateDir; subBackendName = "cloud"; diff --git a/nix/workbench/backend/nomad/exec.nix b/nix/workbench/backend/nomad/exec.nix index 8c4208286a3..62598230d3a 100644 --- a/nix/workbench/backend/nomad/exec.nix +++ b/nix/workbench/backend/nomad/exec.nix @@ -1,5 +1,4 @@ { pkgs -, lib , haskellProject , stateDir , basePort # ignored, just passed to the runner (unlike `supervisor.nix`). @@ -38,7 +37,7 @@ let # Build a Nomad Job specification for this Nomad "sub-backend". materialise-profile = let params = { - inherit pkgs lib; + inherit pkgs; inherit haskellProject; inherit stateDir; subBackendName = "exec"; diff --git a/nix/workbench/backend/runner.nix b/nix/workbench/backend/runner.nix index e539efd3008..e2b7315f4c4 100644 --- a/nix/workbench/backend/runner.nix +++ b/nix/workbench/backend/runner.nix @@ -1,4 +1,4 @@ -{ pkgs, lib +{ pkgs ## The binaries/scripts to use when calling the workbench. , haskellProject , workbench # The derivation. @@ -56,7 +56,7 @@ let fi export CARDANO_NODE_SOCKET_PATH=${stateDir}/node-0/node.socket '' - + lib.optionalString (profileBundle.profile.value.scenario == "chainsync") ( + + pkgs.lib.optionalString (profileBundle.profile.value.scenario == "chainsync") ( let cardano-mainnet-mirror = # "nix" branch last commit 819488be9eabbba6aaa7c931559bc584d8071e3d __getFlake "github:input-output-hk/cardano-mainnet-mirror/nix"; diff --git a/nix/workbench/backend/supervisor-conf.nix b/nix/workbench/backend/supervisor-conf.nix index 7ccc44f16fc..12cd1e1e2b4 100644 --- a/nix/workbench/backend/supervisor-conf.nix +++ b/nix/workbench/backend/supervisor-conf.nix @@ -1,5 +1,4 @@ { pkgs -, lib , stateDir , profile , profiling @@ -11,9 +10,10 @@ , inetHttpServerPort ? null }: -with lib; - let + + inherit (pkgs) lib; + # The prefix for every "[program:X] command=sh start.sh" because `supervisord` # may run in the most unexpected places where we can't asume what is or isn't # included in $PATH. Just make sure pkgs.bashInteractive is in the nix store. @@ -255,4 +255,4 @@ let ; in - generators.toINI {} supervisorConf + lib.generators.toINI {} supervisorConf diff --git a/nix/workbench/backend/supervisor.nix b/nix/workbench/backend/supervisor.nix index 76b4839b1fd..94bcbe5ab8d 100644 --- a/nix/workbench/backend/supervisor.nix +++ b/nix/workbench/backend/supervisor.nix @@ -1,5 +1,4 @@ { pkgs -, lib , haskellProject , stateDir , basePort @@ -7,7 +6,7 @@ , profiling , ... }: -with lib; +with pkgs.lib; let extraShellPkgs = with pkgs; [ @@ -22,7 +21,7 @@ let "workbench-backend-data-${profileBundle.profile.value.name}-supervisor" { # Create a `supervisord.conf` supervisorConf = import ./supervisor-conf.nix - { inherit pkgs lib stateDir; + { inherit pkgs stateDir; profile = profileBundle.profile.value; inherit profiling; nodeSpecs = profileBundle.node-specs.value; diff --git a/nix/workbench/default.nix b/nix/workbench/default.nix index 6f0c314085d..9c72e0724db 100644 --- a/nix/workbench/default.nix +++ b/nix/workbench/default.nix @@ -1,5 +1,5 @@ # The workbench entrypoint, -{ pkgs, lib +{ pkgs # This provided project attrset will be used all over the workbench instead # of the flake's `pkgs` or `cardanoNodePackages`. This allows to easily # parametrize the whole build at any point, be it only for the workbench in @@ -14,10 +14,10 @@ , haskellProject }: -with lib; - let + inherit (pkgs) lib; + # Workbench derivation to create derivations from `wb` commands. ############################################################################## @@ -43,7 +43,7 @@ let profile = [".sh" ".json"]; topology = [".sh"]; }; - in lib.any id [ + in lib.any lib.id [ # Include the "wb" file (has no ".sh", workbench's entrypoint). (relativePath == "wb") # Include all top level "*.sh" files. @@ -61,8 +61,8 @@ let ) ) # Include only the extensions defined above. - (lib.any id - (lib.attrValues (mapAttrs + (lib.any lib.id + (lib.attrValues (lib.mapAttrs (dirName: suffixes: (lib.hasPrefix (dirName + "/") relativePath) && @@ -108,7 +108,7 @@ let # Output ################################################################################ -in pkgs.lib.fix (self: { +in lib.fix (self: { inherit workbench; inherit haskellProject; @@ -118,7 +118,7 @@ in pkgs.lib.fix (self: { # profileName -> profile profile = profileName: (import ./profile/profile.nix - { inherit pkgs lib; + { inherit pkgs; workbenchNix = self; inherit profileName; } @@ -143,7 +143,7 @@ in pkgs.lib.fix (self: { , profiling }: (backendRegistry."${backendName}") - { inherit pkgs lib; + { inherit pkgs; inherit haskellProject; inherit stateDir basePort; # The `useCabalRun` and `profiling` flags are set in the backend to @@ -187,7 +187,7 @@ in pkgs.lib.fix (self: { ; in import ./backend/runner.nix { - inherit pkgs lib; + inherit pkgs; inherit haskellProject; inherit workbench; inherit profile backend; diff --git a/nix/workbench/profile/profile.nix b/nix/workbench/profile/profile.nix index 9bbef04d777..5bcbdbac7b0 100644 --- a/nix/workbench/profile/profile.nix +++ b/nix/workbench/profile/profile.nix @@ -1,4 +1,4 @@ -{ pkgs, lib +{ pkgs # The workbench attrset as it was parametrized. , workbenchNix , profileName From 9699cf2d68632e09ac5990b83ade22102f68e283 Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Fri, 12 Dec 2025 17:58:10 +0000 Subject: [PATCH 10/10] wb | remove keep-alive loop from hydra workbench-ci-test input --- nix/workbench/backend/runner.nix | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/nix/workbench/backend/runner.nix b/nix/workbench/backend/runner.nix index e2b7315f4c4..d96269d6d2e 100644 --- a/nix/workbench/backend/runner.nix +++ b/nix/workbench/backend/runner.nix @@ -141,29 +141,12 @@ let cache_key_input=$(wb genesis profile-cache-key-input ${profileJson}) cache_key=$( wb genesis profile-cache-key ${profileJson}) - genesis_keepalive() { - while test ! -e $out/profile - do - echo 'genesis_keepalive for Hydra' - sleep 10s - done - } - genesis_keepalive & - __genesis_keepalive_pid=$! - __genesis_keepalive_termination() { - kill $__genesis_keepalive_pid 2>/dev/null || true - } - trap __genesis_keepalive_termination EXIT - - time \ - wb genesis actually-genesis \ - "${profileJson}" \ - "${nodeSpecsJson}" \ - "$out" \ - "$cache_key_input" \ - "$cache_key" - - touch done + wb genesis actually-genesis \ + "${profileJson}" \ + "${nodeSpecsJson}" \ + "$out" \ + "$cache_key_input" \ + "$cache_key" '' ; # Run the profile.