Skip to content

Commit 42809ad

Browse files
authored
Merge pull request #4113 from input-output-hk/bench-master
workbench: fixes
2 parents ab2caac + 68b1b9e commit 42809ad

File tree

12 files changed

+83
-88
lines changed

12 files changed

+83
-88
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ ARGS ?=
1616
CMD ?=
1717
RUN ?=
1818

19-
lint hlint:
19+
lint hlint: ## Run the CI version of hlint
20+
nix build --no-link '.#checks/hlint' --cores 0
21+
host-hlint: ## Run the system (not Nix) version of hlint
2022
hlint bench cardano-{api,cli,client-demo,node,node-capi,node-chairman,submit-api,testnet,tracer}
2123

2224
stylish-haskell: ## Apply stylish-haskell on all *.hs files

bench/locli/locli.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ library
100100
, ouroboros-consensus
101101
-- for Data.SOP.Strict:
102102
, ouroboros-network
103-
, perf
104103
, process
105104
, quiet
106105
, scientific

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212

213213
shell = import ./shell.nix { inherit pkgs customConfig cardano-mainnet-mirror; };
214214
devShells = {
215-
inherit (shell) devops;
215+
inherit (shell) devops workbench-shell;
216216
cluster = shell;
217217
profiled = project.profiled.shell;
218218
};

nix.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ membench-5-at: ## Membench: 5 iterations, set commit by: make membench-5-at RE
1414
nix build .#membench-node-this-5.batch-report --out-link result-batch-5-report --override-input node-measured github:input-output-hk/cardano-node/${REV}
1515

1616
workbench-ci-test smoke: ## Workbench: test a-la Hydra, the ci-test profile, full Nix engaged
17-
nix build '.#hydraJobsPr.linux.native.workbench-ci-test' --cores 0 --out-link result-ci-test
17+
nix build --out-link result-ci-test '.#hydraJobsPr.linux.native.workbench-ci-test' --cores 0
18+
mv result-ci-test run/`jq -r .meta.tag result-ci-test/meta.json`

nix/workbench/profile.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ case "$op" in
3030

3131
all-profiles | generate-all | all )
3232
with_era_profiles '
33-
map (profiles(.; null; null; []))
33+
map (generate_all_era_profiles(.; null; null))
3434
| add
3535
';;
3636

3737
all-profile-names | names | all-names )
3838
with_era_profiles '
39-
map (profile_names(.; null; null; []))
39+
map (generate_all_era_profiles(.; null; null) | map(.name))
4040
| add
4141
';;
4242

@@ -45,7 +45,9 @@ case "$op" in
4545
local name=${1:?$usage}
4646

4747
with_era_profiles '
48-
map (has_profile(.; null; null; []; $name))
48+
map (generate_all_era_profiles(.; null; null)
49+
| map (.name == $name)
50+
| any)
4951
| any
5052
' --exit-status --arg name "$name" >/dev/null
5153
;;
@@ -84,7 +86,7 @@ case "$op" in
8486
local name=${1:?$usage}
8587

8688
profile json $name |
87-
jq 'include "derived";
89+
jq 'include "prof2-derived";
8890
8991
profile_pretty_describe(.)
9092
' --raw-output -L "$global_basedir/profiles" -L "$global_basedir";;

nix/workbench/profiles/adhoc.jq

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

nix/workbench/profiles/defaults.jq renamed to nix/workbench/profiles/prof0-defaults.jq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Testable with:
22
##
3-
## jq -n 'include "defaults" { search: "nix/workbench/profiles" }; era_defaults("babbage")'
3+
## jq -n 'include "prof0-defaults" { search: "nix/workbench/profiles" }; era_defaults("babbage")'
44
##
55
def era_defaults($era):
66
{ common:

nix/workbench/profiles/variants.jq renamed to nix/workbench/profiles/prof1-variants.jq

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,4 +470,24 @@ def all_profile_variants:
470470
, $scenario_chainsync * $chaindb_early_alonzo * $p2p *
471471
{ name: "chainsync-early-alonzo-p2p"
472472
}
473+
474+
## Last, but not least, the profile used by "nix-shell -A devops":
475+
, { name: "devops"
476+
, scenario: "idle"
477+
, genesis:
478+
{ slot_duration: 0.2
479+
, parameter_k: 10
480+
, epoch_length: 1000
481+
, active_slots_coeff: 0.1
482+
, genesis_future_offset: "10 seconds"
483+
, utxo: 0
484+
485+
, shelley:
486+
{ updateQuorum: 1
487+
}
488+
}
489+
, analysis:
490+
{ type: null
491+
}
492+
}
473493
];

nix/workbench/profiles/derived.jq renamed to nix/workbench/profiles/prof2-derived.jq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include "defaults";
1+
include "prof0-defaults";
22
include "genesis";
33
include "lib";
44

nix/workbench/profiles/profiles.jq

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
## - era-dependent defaults for the aforementioned sections:
1818
## - profiles/defaults.jq
1919
##
20-
## - overlaid with generated profile variants + ad-hoc profiles:
21-
## - profiles/variants.jq and profiles/adhoc.jq
20+
## - overlaid with generated profile variants (including adhoc profiles):
21+
## - profiles/variants.jq
2222
##
2323
## - each then further overlaid with derived parameters, computed from the above:
2424
## - profiles/derived.jq
@@ -58,39 +58,54 @@
5858
## ..which simply calls ./profiles.nix with {} params.
5959
##
6060

61-
include "topology";
62-
include "defaults";
63-
include "adhoc";
64-
include "variants";
65-
include "derived";
61+
include "prof0-defaults";
62+
include "prof1-variants";
63+
include "prof2-derived";
6664

67-
def compute_profiles($era; $mcompo; $topo; $extra_profiles):
65+
## Cluster composition is an extract from the topology,
66+
## that classifies nodes into BFT, regular pools and dense pools,
67+
## based on the 'pools' field.
68+
##
69+
## Testable with:
70+
##
71+
## jq -n 'include "composition" { search: "nix/workbench/profiles" }; topology_composition({ coreNodes: { bft1: { pools: 0 } } })'
72+
##
73+
def topology_composition($topo):
74+
$topo
75+
| (.Producers // .coreNodes // {})
76+
| to_entries
77+
| map (.value.pools // 0)
78+
| length as $n_hosts
79+
| map (select (. == 0)) as $bfts
80+
| map (select (. != 0)) as $pools
81+
| ($pools | map (select (. == 1))) as $singular_pools
82+
| ($pools | map (select (. > 1))) as $dense_pools
83+
| ($singular_pools | length) as $n_singular_hosts
84+
| { n_bft_hosts: ($bfts | length)
85+
, n_singular_hosts: ($singular_pools | length)
86+
, n_dense_hosts: ($dense_pools | length)
87+
};
88+
89+
##
90+
## This is the workbench's entry point for everything profile.
91+
##
92+
## generate_all_era_profiles :: Era -> Maybe Composition -> Topology -> Map Name Profile
93+
##
94+
def generate_all_era_profiles($era; $mcompo; $topo):
6895
($mcompo // topology_composition($topo // {}) // {}) as $compo
6996

70-
## Profiles are variants + custom (or aux) profiles:
71-
| all_profile_variants + adhoc_profiles + $extra_profiles
72-
| map (## Each profile extends defaults:
73-
era_defaults($era) * .
97+
| all_profile_variants
98+
| map (## Each profile is defined as extension of defaults:
99+
era_defaults($era) ## prof0-defaults.jq
100+
* . ## prof1-variants.jq
74101

75-
## Profiles can define their own cluster composition.
102+
## Profiles define their own cluster composition:
76103
| . * { composition: (.composition // $compo) }
77104

78-
## Compute the derived params.
79-
| add_derived_params
80-
);
81-
82-
def profiles($era; $mcompo; $topo; $extra_profiles):
83-
compute_profiles($era; $mcompo; $topo; $extra_profiles)
105+
## Finally, compute the derived ("computed") params.
106+
| add_derived_params ## prof2-derived.jq
107+
)
84108
| map (## Assemble into a dictionary..
85109
{ "\(.name)": .
86110
})
87111
| add;
88-
89-
def profile_names($era; $mcompo; $topo; $extra_profiles):
90-
compute_profiles($era; $mcompo; $topo; $extra_profiles)
91-
| map (.name);
92-
93-
def has_profile($era; $mcompo; $topo; $extra_profiles; $name):
94-
compute_profiles($era; $mcompo; $topo; $extra_profiles)
95-
| map (.name == $name)
96-
| any;

nix/workbench/profiles/topology.jq

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

nix/workbench/supervisor-run.nix

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ let
6969
echo "workbench: alternate command for this action: wb run restart" >&2
7070
'';
7171

72-
nodeBuildProducts =
72+
nodeBuildProduct =
7373
name:
74-
"report ${name}.log $out ${name}/stdout";
74+
"report ${name}-log $out ${name}/stdout";
7575

7676
profile-run =
7777
{ trace ? false }:
@@ -134,12 +134,11 @@ let
134134
rmdir run/$tag run
135135
136136
cat > $out/nix-support/hydra-build-products <<EOF
137-
report workbench.log $out wb-start.log
138-
report meta.json $out meta.json
137+
report workbench-log $out wb-start.log
138+
report meta $out meta.json
139139
${pkgs.lib.concatStringsSep "\n"
140-
(map nodeBuildProducts (__attrNames profileNix.node-specs.value))}
141-
report node-0 $out meta.json
142-
report archive.tar.zst $out archive.tar.zst
140+
(map nodeBuildProduct (__attrNames profileNix.node-specs.value))}
141+
report archive-tar-zst $out archive.tar.zst
143142
EOF
144143
145144
echo "workbench-test: completed run $tag"

0 commit comments

Comments
 (0)