Skip to content

Commit c13177f

Browse files
authored
Merge pull request #5983 from IntersectMBO/bench-commit
Bench refactoring and fixes
2 parents f7b901e + 539fa09 commit c13177f

24 files changed

+335
-647
lines changed

bench/cardano-profile/app/cardano-profile.hs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ import qualified Cardano.Benchmarking.Profile.Types as Types
1616

1717
--------------------------------------------------------------------------------
1818

19-
data Cli = Names | All | ByName String | LibMK | ToJson String | FromJson String
19+
data Cli =
20+
Names
21+
| NamesCloudNoEra
22+
| All
23+
| ByName String
24+
| LibMK
25+
| ToJson String
26+
| FromJson String
2027

2128
--------------------------------------------------------------------------------
2229

@@ -26,6 +33,8 @@ main = do
2633
case cli of
2734
-- Print all profile names.
2835
Names -> BSL8.putStrLn $ Aeson.encode Profiles.names
36+
-- Print all cloud profile (-nomadperf) names.
37+
NamesCloudNoEra -> BSL8.putStrLn $ Aeson.encode Profiles.namesCloudNoEra
2938
-- Print a map with all profiles, with an optional overlay.
3039
All -> do
3140
obj <- lookupOverlay
@@ -76,6 +85,12 @@ cliParser = OA.hsubparser $
7685
(pure Names)
7786
(OA.fullDesc <> OA.header "names" <> OA.progDesc "All profiles names")
7887
)
88+
<>
89+
OA.command "names-cloud-noera"
90+
(OA.info
91+
(pure NamesCloudNoEra)
92+
(OA.fullDesc <> OA.header "names" <> OA.progDesc "All cloud profiles names (no era suffix)")
93+
)
7994
<>
8095
OA.command "all"
8196
(OA.info

bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
--------------------------------------------------------------------------------
55

66
module Cardano.Benchmarking.Profile (
7-
names, namesNoEra
7+
names, namesNoEra, namesCloudNoEra
88
, byName
99
, profiles
1010
, libMk
@@ -51,6 +51,10 @@ names :: [String]
5151
-- Overlay not supported here, using an empty overlay.
5252
names = Map.keys (profiles mempty)
5353

54+
namesCloudNoEra :: [String]
55+
-- Overlay not supported here, using an empty overlay.
56+
namesCloudNoEra = map Types.name profilesNoEraCloud
57+
5458
-- Names:
5559
-- wb profile all-profiles | jq .[] | jq -r .name | sort | uniq | grep "\-bage"
5660
namesNoEra :: [String]

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
workbenchStartArgs = [ "--create-testnet-data" "--trace" ];
212212
};
213213

214-
inherit (pkgs) all-profiles-json;
214+
inherit (pkgs) all-profiles-json profile-data-nomadperf;
215215

216216
system-tests = pkgs.writeShellApplication {
217217
name = "system-tests";

nix.mk

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ bump-node-measured:
44
nix flake lock --update-input node-measured
55
bump-cardano-deployment: ## Sync the flake.lock to the CI check
66
nix run nixpkgs#nixUnstable -- build .#hydraJobs.cardano-deployment
7-
membench-1: ## Membench: one iteration, current commit
8-
nix build .#membench-node-this-1.batch-report --out-link result-batch-1-report
9-
membench-1-at: ## Membench: one iteration, set commit by: make membench-1-at REV=[master]
10-
nix build .#membench-node-measured-1.batch-report --out-link result-batch-1-report --override-input node-measured github:intersectmbo/cardano-node/${REV}
11-
membench-5: ## Membench: 5 iterations, current commit
12-
nix build .#membench-node-this-5.batch-report --out-link result-batch-5-report
13-
membench-5-at: ## Membench: 5 iterations, set commit by: make membench-5-at REV=[master]
14-
nix build .#membench-node-this-5.batch-report --out-link result-batch-5-report --override-input node-measured github:intersectmbo/cardano-node/${REV}
157

168
CI_TEST_NIXATTR = workbench-ci-test
179
workbench-ci-test smoke: ## Workbench: test a-la Hydra, the ci-test profile, full Nix engaged

nix/custom-config.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ self: {
55
cacheDir = "${self.localCluster.stateDir}/.cache";
66
stateDir = "run/current";
77
batchName = "undefined";
8-
profileName = "default-bage";
8+
profileName = "default-coay";
99
backendName = "supervisor";
1010
basePort = 30000;
1111
workbenchDevMode = true;

nix/pkgs.nix

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,36 @@
22
final: prev:
33

44
let
5-
inherit (prev) customConfig;
6-
inherit (final) pkgs cardanoNodePackages cardanoNodeProject;
5+
inherit (final) pkgs;
76
inherit (prev.pkgs) lib;
7+
inherit (prev) customConfig;
88

9-
# A generic, fully parameteric version of the workbench development environment.
10-
workbench = pkgs.callPackage ./workbench {};
9+
# A generic, fully parametric version of the workbench development environment.
10+
workbench = import ./workbench
11+
{inherit pkgs lib; inherit (final) cardanoNodePackages cardanoNodeProject;};
1112

12-
# A conveniently-parametrisable workbench preset.
13-
# See https://input-output-hk.github.io/haskell.nix/user-guide/development/
14-
# The general idea is:
15-
# 1. backendName -> stateDir -> basePort -> useCabalRun -> backend
16-
# 2. batchName -> profileName -> profiling -> backend -> workbench -> runner
17-
# * `workbench` is in case a pinned version of the workbench is needed.
13+
# Workbench runner instantiated by parameters from customConfig:
1814
workbench-runner =
19-
let
20-
backendRegistry =
21-
{
22-
nomadcloud = params:
23-
import ./workbench/backend/nomad/cloud.nix params;
24-
nomadexec = params:
25-
import ./workbench/backend/nomad/exec.nix params;
26-
supervisor = params:
27-
import ./workbench/backend/supervisor.nix params;
28-
}
29-
;
30-
in
31-
{ stateDir ? customConfig.localCluster.stateDir
32-
, batchName ? customConfig.localCluster.batchName
33-
, profileName ? customConfig.localCluster.profileName
15+
{ profileName ? customConfig.localCluster.profileName
16+
, profiling ? customConfig.profiling
3417
, backendName ? customConfig.localCluster.backendName
18+
, stateDir ? customConfig.localCluster.stateDir
3519
, basePort ? customConfig.localCluster.basePort
3620
, useCabalRun ? customConfig.localCluster.useCabalRun
3721
, workbenchDevMode ? customConfig.localCluster.workbenchDevMode
22+
, batchName ? customConfig.localCluster.batchName
3823
, workbenchStartArgs ? customConfig.localCluster.workbenchStartArgs
39-
, profiling ? customConfig.profiling
4024
, cardano-node-rev ? null
41-
, workbench ? pkgs.workbench
4225
}:
43-
let
44-
# The `useCabalRun` flag is set in the backend to allow the backend to
45-
# override its value. The runner uses the value of `useCabalRun` from
46-
# the backend to prevent a runner using a different value.
47-
backend = (backendRegistry."${backendName}")
48-
{ inherit pkgs lib stateDir basePort useCabalRun; };
49-
in import ./workbench/backend/runner.nix
50-
{
51-
inherit pkgs lib cardanoNodePackages;
52-
inherit batchName profileName backend;
53-
inherit cardano-node-rev;
54-
inherit workbench workbenchDevMode workbenchStartArgs profiling;
26+
workbench.runner
27+
{ inherit profileName profiling backendName stateDir basePort useCabalRun;
28+
inherit batchName workbenchDevMode workbenchStartArgs cardano-node-rev;
5529
};
5630

57-
# Workbench instantiated by parameters from customConfig:
58-
custom-config-workbench-runner = workbench-runner {};
59-
6031
in with final;
6132
{
6233
inherit (cardanoNodeProject.args) compiler-nix-name;
34+
6335
inherit workbench workbench-runner;
6436

6537
cabal = haskell-nix.cabal-install.${compiler-nix-name};
@@ -156,6 +128,51 @@ in with final;
156128

157129
all-profiles-json = workbench.profile-names-json;
158130

131+
# The profile data and backend data of the cloud / "*-nomadperf" profiles.
132+
# Useful to mix workbench and cardano-node commits, mostly because of scripts.
133+
profile-data-nomadperf = builtins.listToAttrs (
134+
builtins.map
135+
(cloudName:
136+
# Only Conway era cloud profiles are flake outputs.
137+
let profileName = "${cloudName}-coay";
138+
in {
139+
name = profileName;
140+
value =
141+
let
142+
# Default values only ("run/current", 30000, profiling "none").
143+
profile = workbench.profile {
144+
inherit profileName;
145+
inherit (customConfig) profiling;
146+
};
147+
backend = workbench.backend
148+
{ backendName = "nomadcloud";
149+
stateDir = customConfig.localCluster.stateDir;
150+
basePort = customConfig.localCluster.basePort;
151+
useCabalRun = customConfig.localCluster.useCabalRun;
152+
}
153+
;
154+
profileData = profile.materialise-profile
155+
{ inherit backend; }
156+
;
157+
backendData = backend.materialise-profile {inherit profileData;};
158+
in pkgs.runCommand "workbench-data-${profileName}" {}
159+
''
160+
mkdir $out
161+
ln -s ${profileData} $out/profileData
162+
ln -s ${backendData} $out/backendData
163+
''
164+
;
165+
}
166+
)
167+
# Fetch all "*-nomadperf" profiles.
168+
(__fromJSON (__readFile
169+
(pkgs.runCommand "cardano-profile-names-cloud-noera" {} ''
170+
${cardanoNodePackages.cardano-profile}/bin/cardano-profile names-cloud-noera > $out
171+
''
172+
)
173+
))
174+
);
175+
159176
# Disable failing python uvloop tests
160177
python39 = prev.python39.override {
161178
packageOverrides = pythonFinal: pythonPrev: {
@@ -164,5 +181,4 @@ in with final;
164181
});
165182
};
166183
};
167-
} //
168-
custom-config-workbench-runner.overlay final prev
184+
}

nix/workbench/analyse/analyse.nix

Lines changed: 0 additions & 37 deletions
This file was deleted.

nix/workbench/backend/nomad/cloud.nix

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ let
4141
in (import ../nomad.nix params).materialise-profile
4242
;
4343

44-
overlay =
45-
proTopo: self: super:
46-
{
47-
}
48-
;
49-
5044
service-modules = {
5145
node = { config, ... }:
5246
let selfCfg = config.services.cardano-node;
@@ -63,7 +57,7 @@ in
6357

6458
inherit extraShellPkgs;
6559
inherit materialise-profile;
66-
inherit overlay service-modules;
60+
inherit service-modules;
6761
inherit stateDir basePort;
6862

6963
inherit useCabalRun;

nix/workbench/backend/nomad/exec.nix

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ let
3939
in (import ../nomad.nix params).materialise-profile
4040
;
4141

42-
overlay =
43-
proTopo: self: super:
44-
{
45-
}
46-
;
47-
4842
service-modules = {
4943
node = { config, ... }:
5044
let selfCfg = config.services.cardano-node;
@@ -61,7 +55,7 @@ in
6155

6256
inherit extraShellPkgs;
6357
inherit materialise-profile;
64-
inherit overlay service-modules;
58+
inherit service-modules;
6559
inherit stateDir basePort;
6660

6761
inherit useCabalRun;

0 commit comments

Comments
 (0)