Skip to content

Commit 003bfdf

Browse files
authored
Merge pull request #6190 from IntersectMBO/bench-eventlogged
Bench eventlogged
2 parents a8730d1 + d18c96d commit 003bfdf

File tree

6 files changed

+23
-119
lines changed

6 files changed

+23
-119
lines changed

nix/workbench/backend/nomad.nix

+6-13
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
, lib
33
, stateDir
44
, subBackendName
5-
# TODO: Fetch this from config services inside materialise-profile !
6-
, eventlogged ? true
75
, ...
86
}:
97
let
@@ -54,7 +52,7 @@ let
5452
# path of this packages while keeping the extra details as a `jq` friendly
5553
# reference that are used to change it later appending the desired commit
5654
# (interchanging commits it's still an untested feature).
57-
# For cloud runs references:
55+
# For "nomadcloud" runs workbench's `$WB_GITREV` is used as commit:
5856
# installable="${flakeReference}/${commit}#${flakeOutput}"
5957
installables =
6058
{
@@ -144,23 +142,18 @@ let
144142
{
145143
# Provided that all the "start.sh" scripts are taking it into account,
146144
# this packages could be configured to come from a different commit than
147-
# the one used to enter the shell ??????????
145+
# the one used to enter the shell.
148146
cardano-node = rec {
149147
# Local reference only used if not "cloud".
150-
nix-store-path = with pkgs;
151-
if eventlogged
152-
then cardanoNodePackages.cardano-node.passthru.eventlogged
153-
else cardanoNodePackages.cardano-node.passthru.noGitRev
154-
;
148+
# Avoid rebuilding on every commit because of `set-git-rev`.
149+
nix-store-path = pkgs.cardanoNodePackages.cardano-node.passthru.noGitRev;
155150
flake-reference = "github:intersectmbo/cardano-node";
156-
flake-output =
157-
if eventlogged
158-
then "cardanoNodePackages.cardano-node.passthru.eventlogged"
159-
else "cardanoNodePackages.cardano-node.passthru.noGitRev"
151+
flake-output = "cardanoNodePackages.cardano-node.passthru.noGitRev"
160152
;
161153
};
162154
cardano-cli = rec {
163155
# Local reference only used if not "cloud".
156+
# Avoid rebuilding on every commit because of `set-git-rev`.
164157
nix-store-path = pkgs.cardanoNodePackages.cardano-cli.passthru.noGitRev;
165158
flake-reference = "github:input-output-hk/cardano-cli";
166159
flake-output = "cardanoNodePackages.cardano-cli.passthru.noGitRev";

nix/workbench/backend/nomad/cloud.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ allocate-run-nomadcloud() {
334334
# outputs it needs inside the container, these are built using the packages
335335
# metadata in "containerPkgs" and the current commit.
336336
local gitrev
337-
gitrev="$(git rev-parse HEAD)"
338-
msg $(blue "INFO: Found GitHub commit with ID \"$gitrev\"")
337+
gitrev="${WB_GITREV:?"No WB_GITREV"}"
338+
msg $(blue "INFO: Found GitHub commit with ID \"$gitrev\" set on shell creation")
339339
# Check if the Nix package was created from a dirty git tree
340340
if test "$gitrev" = "0000000000000000000000000000000000000000"
341341
then

nix/workbench/backend/runner.nix

+6-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ let
3838
# build plan as computed by nix
3939
nixPlanJson = cardanoNodeProject.plan-nix.json;
4040

41+
# Optimize cache hits setting gitrev using bash once inside the shell.
4142
workbench-envars =
4243
''
4344
export WB_CHAP_PATH=${chap}
@@ -50,6 +51,10 @@ let
5051
export WB_DEPLOYMENT_NAME=''${WB_DEPLOYMENT_NAME:-$(basename $(pwd))}
5152
export WB_MODULAR_GENESIS=''${WB_MODULAR_GENESIS:-0}
5253
export WB_LOCLI_DB=''${WB_LOCLI_DB:-1}
54+
if test -z "$(git status --porcelain --untracked-files=no)"
55+
then export WB_GITREV="$(git rev-parse HEAD)"
56+
else export WB_GITREV="0000000000000000000000000000000000000000"
57+
fi
5358
export CARDANO_NODE_SOCKET_PATH=${stateDir}/node-0/node.socket
5459
''
5560
+ lib.optionalString (profileBundle.profile.value.scenario == "chainsync") (
@@ -112,7 +117,7 @@ let
112117
gnused
113118
procps
114119
nix
115-
git
120+
git # `workbench-envars` set the gitrev
116121
jq
117122
]
118123
)

nix/workbench/run.sh

+3-94
Original file line numberDiff line numberDiff line change
@@ -330,33 +330,6 @@ EOF
330330
test -f "$dir"/profile.json -a -f "$dir"/genesis-shelley.json ||
331331
run fix-legacy-run-structure "$run";;
332332

333-
fix-systemstart )
334-
local usage="USAGE: wb run $op RUN [MACH=node-1]"
335-
local run=${1:?$usage}
336-
local mach=${2:-node-0}
337-
local dir=$(run compute-path "$run")
338-
local nodelog=$(ls $dir/logs/$mach/node-*.json | head -n1)
339-
local genesis=$dir/genesis-shelley.json
340-
341-
msg "cross-checking systemStart of $run: $nodelog"
342-
local apparent_systemStart=$(grep -F 'TraceStartLeadershipCheck' $nodelog |
343-
head -n2 |
344-
tail -n1 |
345-
jq '[ (.at | "\(.[:19])Z" | fromdateiso8601)
346-
, .data.slot
347-
] | .[0] - .[1]
348-
| todateiso8601' -r)
349-
local genesis_systemStart=$(jq .systemStart $genesis -r)
350-
351-
if test "$genesis_systemStart" != "$apparent_systemStart"
352-
then msg "Fixing genesis systemStart in $run: $apparent_systemStart (log), $genesis_systemStart (genesis)"
353-
jq_fmutate "$dir"/genesis-shelley.json '. *
354-
{ systemStart: $systemStart
355-
}
356-
' --arg systemStart $apparent_systemStart
357-
else msg "Good: both genesis and log-implied systemStart are at: $genesis_systemStart"
358-
fi;;
359-
360333
get-path | get )
361334
local usage="USAGE: wb run $op [--query] RUN"
362335
local check_args=()
@@ -588,71 +561,9 @@ EOF
588561
profile describe "$dir"/profile.json
589562
;;
590563

591-
allocate-from-machine-run-slice | alloc-from-mrs )
592-
local usage="USAGE: wb run $op MACH RUN-SLICE-ID PRESET"
593-
local mach=${1:?$usage}; shift
594-
local run_slice_id=${1:?$usage}; shift
595-
local preset=${1:?$usage}; shift
596-
597-
local args=(
598-
--arg id $run_slice_id
599-
--arg mach $mach
600-
--arg preset $preset
601-
)
602-
local meta=$(jq '
603-
{ Y: $id[0:4], M: $id[4:6], D: $id[6:8] } as $d
604-
| { h: $id[8:10], m: $id[10:12], s: $id[12:14] } as $t
605-
| { tag: "\($d.Y)-\($d.M)-\($d.D)-\($t.h).\($t.m).\($mach)"
606-
, profile: $preset
607-
, date: "\($d.Y)-\($d.M)-\($d.D)T\($t.h):\($t.m):\($t.s)Z"
608-
, batch: $mach
609-
}
610-
| . +
611-
{ timestamp: (.date | fromdateiso8601)
612-
}
613-
| { meta: . }
614-
' "${args[@]}" --null-input)
615-
local run=$(jq '.meta.tag' -r <<<$meta)
616-
local dir="$global_rundir"/$run
617-
618-
mkdir -p "$dir"/$mach
619-
local genesis=$(profile preset-get-file "$preset" 'genesis' 'genesis/genesis-shelley.json')
620-
cp -f "$genesis" "$dir"/genesis-shelley.json
621-
ln -sf genesis-shelley.json "$dir"/genesis.json
622-
jq <<<$meta '
623-
$gsisf[0] as $gsis
624-
| . *
625-
{ meta:
626-
{ profile_content:
627-
{ genesis:
628-
{ active_slots_coeff: $gsis.activeSlotsCoeff
629-
, delegators: 1000000
630-
, dense_pool_density: 1
631-
, epoch_length: $gsis.epochLength
632-
, parameter_k: $gsis.securityParam
633-
, n_pools: 1
634-
, slot_duration: $gsis.slotLength
635-
, utxo: 4000000
636-
}
637-
, generator:
638-
{ add_tx_size: 0
639-
, inputs_per_tx: 1
640-
, outputs_per_tx: 1
641-
, tps: 8
642-
, tx_count: 0
643-
, era: "alonzo"
644-
}
645-
}
646-
}
647-
}
648-
' --slurpfile gsisf "$dir"/genesis-shelley.json > "$dir"/meta.json
649-
650-
echo $dir;;
651-
652564
fetch-run | fetch | fr )
653-
local usage="USAGE: wb run $op RUN [MACHINE]"
565+
local usage="USAGE: wb run $op RUN"
654566
local run=${1:?$usage}
655-
local mach=${2:-all-hosts}
656567

657568
local env=$( jq <<<$remote '.env' -r)
658569
local depl=$(jq <<<$remote '.depl' -r)
@@ -674,7 +585,6 @@ EOF
674585
'
675586

676587
common-run-files
677-
$mach
678588
)
679589
run_remote_get "${args[@]}";;
680590

@@ -909,9 +819,8 @@ run_remote_get() {
909819
generator/plutus-budget-summary.json
910820
)
911821
local xs0=(${objects[*]})
912-
local xs1=(${xs0[*]/#all-hosts/ $(jq -r '.hostname | keys | .[]' <<<$meta)})
913-
local xs2=(${xs1[*]/#common-run-files/ ${common_run_files[*]}})
914-
local xs=(${xs2[*]})
822+
local xs1=(${xs0[*]/#common-run-files/ ${common_run_files[*]}})
823+
local xs=(${xs1[*]})
915824

916825
local count=${#xs[*]}
917826
progress "run | fetch $(white $run)" "objects to fetch: $(white $count) total: ${objects[*]}"

nix/workbench/service/healthcheck.nix

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
, backend
33
, profile
44
, nodeSpecs
5-
, eventlogged ? true
65
}:
76

87
with pkgs.lib;
@@ -14,18 +13,16 @@ let
1413
grep = pkgs.gnugrep;
1514
jq = pkgs.jq;
1615
# Avoid rebuilding the script on every commit.
17-
# Both `eventlogged` and `noGitRev` do not have `set-git-rev`.
16+
# `noGitRev` does not have `set-git-rev` that is set on every commit.
1817
cardano-node = with pkgs;
1918
if backend.useCabalRun
2019
then "cardano-node"
21-
else if eventlogged
22-
then cardanoNodePackages.cardano-node.passthru.eventlogged + "/bin/cardano-node"
23-
else cardanoNodePackages.cardano-node.passthru.noGitRev + "/bin/cardano-node"
20+
else cardanoNodePackages.cardano-node.passthru.noGitRev + "/bin/cardano-node"
2421
;
2522
cardano-cli = with pkgs;
2623
if backend.useCabalRun
2724
then "cardano-cli"
28-
else cardanoNodePackages.cardano-cli.passthru.noGitRev + "/bin/cardano-cli";
25+
else cardanoNodePackages.cardano-cli.passthru.noGitRev + "/bin/cardano-cli";
2926
in {
3027
start =
3128
# Assumptions:

nix/workbench/service/nodes.nix

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ let
145145
} // optionalAttrs (profiling != "none") {
146146
inherit profiling;
147147
} // optionalAttrs (profiling == "none") {
148-
# Switch to `cardano-node.passthru.noGitRev` if eventlog is not needed.
149-
eventlog = mkForce true;
148+
# Switch to `noGitRev` to avoid rebuilding with every commit.
149+
package = pkgs.cardano-node.passthru.noGitRev;
150150
} // optionalAttrs backend.useCabalRun {
151151
# Allow the shell function to take precedence.
152-
executable = "cardano-node";
152+
executable = "cardano-node";
153153
} // optionalAttrs isProducer {
154154
operationalCertificate = "../genesis/node-keys/node${toString i}.opcert";
155155
kesKey = "../genesis/node-keys/node-kes${toString i}.skey";

0 commit comments

Comments
 (0)