From 8d46fb2c11638367a7d285b31486c484240a7ed1 Mon Sep 17 00:00:00 2001 From: Kosyrev Serge Date: Tue, 21 Dec 2021 01:54:38 +0300 Subject: [PATCH] workbench: redo chain filtering specification --- .../base-k10.json} | 6 -- .../base.json} | 0 bench/chain-filters/no-ebnd.json | 7 ++ bench/chain-filters/no-rewards.json | 13 +++ bench/chain-filters/rewards.json | 13 +++ bench/chain-filters/size-full.json | 7 ++ bench/chain-filters/size-mid.json | 13 +++ bench/chain-filters/size-small.json | 13 +++ bench/flt-full.json | 25 ----- bench/flt-midsize.json | 31 ------- bench/flt-small.json | 31 ------- nix/workbench/analyse.sh | 92 +++++++------------ nix/workbench/profiles/defaults.jq | 3 +- nix/workbench/profiles/node-services.nix | 3 +- nix/workbench/run.sh | 12 +++ nix/workbench/wb | 2 - 16 files changed, 115 insertions(+), 156 deletions(-) rename bench/{flt-full-k10.json => chain-filters/base-k10.json} (74%) rename bench/{flt-range.json => chain-filters/base.json} (100%) create mode 100644 bench/chain-filters/no-ebnd.json create mode 100644 bench/chain-filters/no-rewards.json create mode 100644 bench/chain-filters/rewards.json create mode 100644 bench/chain-filters/size-full.json create mode 100644 bench/chain-filters/size-mid.json create mode 100644 bench/chain-filters/size-small.json delete mode 100644 bench/flt-full.json delete mode 100644 bench/flt-midsize.json delete mode 100644 bench/flt-small.json diff --git a/bench/flt-full-k10.json b/bench/chain-filters/base-k10.json similarity index 74% rename from bench/flt-full-k10.json rename to bench/chain-filters/base-k10.json index 08aa821f92a..bdcdb339593 100644 --- a/bench/flt-full-k10.json +++ b/bench/chain-filters/base-k10.json @@ -16,10 +16,4 @@ , "contents": true } } -, { "tag": "CBlock" - , "contents": - { "tag": "BFullnessGEq" - , "contents": 0.9 - } - } ] diff --git a/bench/flt-range.json b/bench/chain-filters/base.json similarity index 100% rename from bench/flt-range.json rename to bench/chain-filters/base.json diff --git a/bench/chain-filters/no-ebnd.json b/bench/chain-filters/no-ebnd.json new file mode 100644 index 00000000000..542f3b43d28 --- /dev/null +++ b/bench/chain-filters/no-ebnd.json @@ -0,0 +1,7 @@ +[ { "tag": "CSlot" + , "contents": + { "tag": "EpSlotGEq" + , "contents": 200 + } + } +] diff --git a/bench/chain-filters/no-rewards.json b/bench/chain-filters/no-rewards.json new file mode 100644 index 00000000000..4988007a02e --- /dev/null +++ b/bench/chain-filters/no-rewards.json @@ -0,0 +1,13 @@ +[ { "tag": "CSlot" + , "contents": + { "tag": "EpochSafeIntLEq" + , "contents": 3 + } + } +, { "tag": "CSlot" + , "contents": + { "tag": "EpochSafeIntGEq" + , "contents": 8 + } + } +] diff --git a/bench/chain-filters/rewards.json b/bench/chain-filters/rewards.json new file mode 100644 index 00000000000..8c8507bd142 --- /dev/null +++ b/bench/chain-filters/rewards.json @@ -0,0 +1,13 @@ +[ { "tag": "CSlot" + , "contents": + { "tag": "EpochSafeIntGEq" + , "contents": 4 + } + } +, { "tag": "CSlot" + , "contents": + { "tag": "EpochSafeIntLEq" + , "contents": 7 + } + } +] diff --git a/bench/chain-filters/size-full.json b/bench/chain-filters/size-full.json new file mode 100644 index 00000000000..2fe94ab0b76 --- /dev/null +++ b/bench/chain-filters/size-full.json @@ -0,0 +1,7 @@ +[ { "tag": "CBlock" + , "contents": + { "tag": "BFullnessGEq" + , "contents": 0.9 + } + } +] diff --git a/bench/chain-filters/size-mid.json b/bench/chain-filters/size-mid.json new file mode 100644 index 00000000000..d48a8be529a --- /dev/null +++ b/bench/chain-filters/size-mid.json @@ -0,0 +1,13 @@ +[ { "tag": "CBlock" + , "contents": + { "tag": "BFullnessGEq" + , "contents": 0.1 + } + } +, { "tag": "CBlock" + , "contents": + { "tag": "BFullnessLEq" + , "contents": 0.9 + } + } +] diff --git a/bench/chain-filters/size-small.json b/bench/chain-filters/size-small.json new file mode 100644 index 00000000000..96380c8526f --- /dev/null +++ b/bench/chain-filters/size-small.json @@ -0,0 +1,13 @@ +[ { "tag": "CBlock" + , "contents": + { "tag": "BFullnessGEq" + , "contents": 0.03 + } + } +, { "tag": "CBlock" + , "contents": + { "tag": "BFullnessLEq" + , "contents": 0.1 + } + } +] diff --git a/bench/flt-full.json b/bench/flt-full.json deleted file mode 100644 index 297ded2bc76..00000000000 --- a/bench/flt-full.json +++ /dev/null @@ -1,25 +0,0 @@ -[ { "tag": "CSlot" - , "contents": - { "tag": "EpochGEq" - , "contents": 2 - } - } -, { "tag": "CSlot" - , "contents": - { "tag": "SlotLEq" - , "contents": 56000 - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BUnitaryChainDelta" - , "contents": true - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BFullnessGEq" - , "contents": 0.9 - } - } -] diff --git a/bench/flt-midsize.json b/bench/flt-midsize.json deleted file mode 100644 index da612d78506..00000000000 --- a/bench/flt-midsize.json +++ /dev/null @@ -1,31 +0,0 @@ -[ { "tag": "CSlot" - , "contents": - { "tag": "EpochGEq" - , "contents": 2 - } - } -, { "tag": "CSlot" - , "contents": - { "tag": "SlotLEq" - , "contents": 56000 - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BUnitaryChainDelta" - , "contents": true - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BFullnessGEq" - , "contents": 0.1 - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BFullnessLEq" - , "contents": 0.9 - } - } -] diff --git a/bench/flt-small.json b/bench/flt-small.json deleted file mode 100644 index 3688d741670..00000000000 --- a/bench/flt-small.json +++ /dev/null @@ -1,31 +0,0 @@ -[ { "tag": "CSlot" - , "contents": - { "tag": "EpochGEq" - , "contents": 2 - } - } -, { "tag": "CSlot" - , "contents": - { "tag": "SlotLEq" - , "contents": 56000 - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BUnitaryChainDelta" - , "contents": true - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BFullnessGEq" - , "contents": 0.03 - } - } -, { "tag": "CBlock" - , "contents": - { "tag": "BFullnessLEq" - , "contents": 0.1 - } - } -] diff --git a/nix/workbench/analyse.sh b/nix/workbench/analyse.sh index 481c4de7af3..f1cb6b3b021 100644 --- a/nix/workbench/analyse.sh +++ b/nix/workbench/analyse.sh @@ -1,32 +1,40 @@ usage_analyse() { usage "analyse" "Analyse cluster runs" < "$keyfile" ## 1. enumerate logs, filter by keyfile & consolidate - local logdirs=($(ls -d "$dir"/node-*/ 2>/dev/null) $(ls -d "$dir"/analysis/node-*/ 2>/dev/null)) - # "$dir"/node-*/ "$dir"/analysis/node-*/ + local logdirs=($(ls -d "$dir"/node-*/ 2>/dev/null)) + local logfiles=($(ls "$adir"/logs-node-*.flt.json 2>/dev/null)) + # echo logfiles: _${logfiles[*]}_ + local prefilter=$(test "$force_prefilter" = 'true' -o -z "${logfiles[*]}" && echo 'true' || echo 'false') - echo "{ \"prefilter\": $prefilter, \"prefilter_jq\": $prefilter_jq }" - if test "$prefilter" = 'true' -o -z "$(ls "$adir"/logs-node-*.flt.json 2>/dev/null)" + echo "{ \"prefilter\": $prefilter }" + if test x$prefilter = xtrue then local jq_args=( --sort-keys @@ -94,16 +102,15 @@ case "$op" in wait fi - echo "{ \"dataSetSizeMB\": $(echo $(($(cat "$adir"/*.flt.json | wc -c) / 1000 / 1000))) }" locli_args+=( --genesis "$dir"/genesis-shelley.json --run-metafile "$dir"/meta.json ## -> --timeline-pretty "$adir"/block-propagation.txt --analysis-json "$adir"/block-propagation.json + $(if test -n "$dump_logobjects" + then echo --logobjects-json "$adir"/logs-cluster.logobjects.json; fi) ) - if test -n "$dump_logobjects"; then - locli_args+=(--logobjects-json "$adir"/logs-cluster.logobjects.json); fi time locli 'analyse' 'block-propagation' \ "${locli_args[@]}" "$adir"/*.flt.json @@ -112,38 +119,6 @@ case "$op" in if test $# -gt 0 then analyse ${self_args[*]} block-propagation "$@"; fi;; - grep-filtered-logs | grep | g ) - local usage="USAGE: wb analyse $op BLOCK [MACHSPEC=*] [RUN-NAME=current]" - local expr=$1 - local mach=${2:-*} - local name=${3:-current} - local dir=$(run get "$name") - local adir=$dir/analysis - - grep -h "$expr" "$adir"/logs-$mach.flt.json;; - - list-blocks | blocks | bs ) - local usage="USAGE: wb analyse $op [RUN-NAME=current]" - local name=${1:-current} - local dir=$(run get "$name") - local adir=$dir/analysis - - fgrep -h "TraceForgedBlock" "$adir"/*.flt.json | - jq '{ at: .at, host: .host } * .data | del(.peer) | del(.slot)' -c | - sort | uniq;; - - block-propagation-block | bpb ) - local usage="USAGE: wb analyse $op BLOCK [RUN-NAME=current]" - local block=$1 - local name=${2:-current} - local dir=$(run get "$name") - local adir=$dir/analysis - - grep -h "$block" "$adir"/*.flt.json | - grep 'AddBlock\|TraceForgedBlock\|AddedToCurrentChain' | - jq '{ at: .at, host: .host } * .data | del(.peer) | del(.slot)' -c | - sort --stable | uniq;; - machine-timeline | machine | mt ) local usage="USAGE: wb analyse $op [RUN-NAME=current] [MACH-NAME=node-1]" local name=${1:-current} @@ -151,14 +126,12 @@ case "$op" in local dir=$(run get "$name") test -n "$dir" || fail "malformed run: $name" - echo "{ \"run\": \"$(jq .meta.tag "$dir"/meta.json --raw-output)\" }" - local adir=$dir/analysis mkdir -p "$adir" ## 0. subset what we care about into the keyfile local keyfile=$adir/substring-keys - locli analyse substring-keys | grep -v 'Temporary modify' > "$keyfile" + locli analyse substring-keys > "$keyfile" if test "$mach" = 'all' then local machs=($(run list-hosts $name)) @@ -168,13 +141,16 @@ case "$op" in do throttle_shell_job_spawns ( ## 1. enumerate logs, filter by keyfile & consolidate - local logs=($(ls "$dir"/$mach/stdout* 2>/dev/null | tac) $(ls "$dir"/$mach/node-*.json 2>/dev/null) $(ls "$dir"/analysis/$mach/node-*.json 2>/dev/null)) consolidated="$adir"/logs-$mach.json + local logs=($(ls "$dir"/$mach/node-*.json 2>/dev/null)) + local consolidated="$adir"/logs-$mach.json test -n "${logs[*]}" || fail "no logs for $mach in run $name" + local prefilter=$(test "$force_prefilter" = 'true' -o -z "$(ls "$adir"/logs-node-*.flt.json 2>/dev/null)" && echo 'yes') + echo "{ \"prefilter\": $prefilter }" - if test "$prefilter" = 'true' -o -z "$(ls "$adir"/logs-$mach.json 2>/dev/null)" + if test -n "$prefilter" then grep -hFf "$keyfile" "${logs[@]}" > "$consolidated"; fi locli_args+=( diff --git a/nix/workbench/profiles/defaults.jq b/nix/workbench/profiles/defaults.jq index 323bfef5bec..3e174088960 100644 --- a/nix/workbench/profiles/defaults.jq +++ b/nix/workbench/profiles/defaults.jq @@ -9,8 +9,6 @@ def era_defaults($era): ## Choice of a cluster run scenario (wb scenario --help): , scenario: "default" - , tracing_backend: "iohk-monitoring" ## or "trace-dispatcher" - ## Cluster topology and composition: , composition: { locations: ["LO"] @@ -73,6 +71,7 @@ def era_defaults($era): , node: { rts_flags_override: [] + , tracing_backend: "iohk-monitoring" ## or "trace-dispatcher" } , tolerances: diff --git a/nix/workbench/profiles/node-services.nix b/nix/workbench/profiles/node-services.nix index 47cb718c03b..74b474d356c 100644 --- a/nix/workbench/profiles/node-services.nix +++ b/nix/workbench/profiles/node-services.nix @@ -129,6 +129,7 @@ let TestAlonzoHardForkAtEpoch = 0; }; }.${profile.value.era}; + }; in backend.finaliseNodeService nodeSpec { @@ -142,7 +143,7 @@ let (if __hasAttr "preset" profile.value then readJSONMay (./presets + "/${profile.value.preset}/config.json") else nodeConfigBits.era_setup_hardforks // - nodeConfigBits.tracing.${profile.tracing_backend})); + nodeConfigBits.tracing.${profile.value.node.tracing_backend})); }; ## Given an env config, evaluate it and produce the node service. diff --git a/nix/workbench/run.sh b/nix/workbench/run.sh index ed3a50032bb..9f7205f80ed 100644 --- a/nix/workbench/run.sh +++ b/nix/workbench/run.sh @@ -351,6 +351,18 @@ case "$op" in then jq 'keys | .[]' -r "$dir"/node-specs.json else jq '.hostname | keys | .[]' -r "$dir"/meta.json; fi;; + fetch-analysis | fa ) + local usage="USAGE: wb run $op ENV DEPL BATCH-OR-TAG.." + local env=${1:?$usage}; shift + local depl=${1:?$usage}; shift + + for x in $* + do + ssh $env -- \ + sh -c "'cd $depl/runs && tar c {*.$x.*,$x}/analysis/{block-propagation,logs-node-1.timeline}.txt --zstd --ignore-failed-read'" 2>/dev/null | + (cd run; tar x --zstd); done + ;; + remote-machine-run-slice-list | rmrsl ) local usage="USAGE: wb run $op ENV DEPL [HOST=DEPL]" local env=${1:?$usage} diff --git a/nix/workbench/wb b/nix/workbench/wb index 6021ad81ea8..5c930e557ae 100755 --- a/nix/workbench/wb +++ b/nix/workbench/wb @@ -49,7 +49,6 @@ usage_extra() { Other OPs: scenario (s) Run scenario control - reanalyse (rea) Re-analyse a cluster run (synonym for analyse --re) call ARGS.. Call internal functions with arguments mode Report mode set by --set-mode @@ -191,7 +190,6 @@ main() { ## Internals: # scenario | s ) scenario "$@";; - reanalyse | rea | re ) analyse --reanalyse "$@";; backend ) backend "$@";; call ) "$@";; mode ) echo -n $global_mode;;