Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbench: small fixes & UX improvements #4665

Merged
merged 3 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions nix/workbench/analyse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ usage_analyse() {
$(helpcmd variance RUN-NAME..)
$(blk var) Variance analyses on a set of runs

$(helpcmd full RUN-NAME..)
$(blk standard std) Standard batch of analyses: block-propagation, and machine-timeline
$(helpcmd standard RUN-NAME..)
$(blk full std) Standard batch of analyses: block-propagation, and machine-timeline

$(helpcmd block-propagation RUN-NAME..)
$(blk blockprop bp) Full block propagation analysis
Expand Down Expand Up @@ -64,6 +64,8 @@ analysis_allowed_loanys=(
'LARollback'
)

analyse_default_op='standard'

analyse() {
local filters=() filter_exprs=() filter_reasons= chain_errors= aws= sargs=() unfiltered= perf_omit_hosts=()
local dump_logobjects= dump_machviews= dump_chain= dump_slots_raw= dump_slots=
Expand Down Expand Up @@ -96,7 +98,7 @@ do case "$1" in
--trace ) sargs+=($1); set -x;;
* ) break;; esac; shift; done

local op=${1:-standard}; if test $# != 0; then shift; fi
local op=${1:-$analyse_default_op}; if test $# != 0; then shift; fi

case "$op" in
# 'read-mach-views' "${logs[@]/#/--log }"
Expand Down Expand Up @@ -159,7 +161,7 @@ case "$op" in
analyse "${sargs[@]}" map "call ${script[*]}" "$@"
;;

full | standard | std )
standard | full | std )
local script=(
logs $(test -n "$dump_logobjects" && echo 'dump-logobjects')
context
Expand Down Expand Up @@ -423,20 +425,20 @@ case "$op" in
v2=(${v1[*]/#read-propagations/ 'read-propagations' ${props[*]} })
v3=(${v2[*]/#multi-clusterperf-json/ 'render-multi-clusterperf' --json $adir/'clusterperf.json' --full $multi_aspect })
v4=(${v3[*]/#multi-clusterperf-org/ 'render-multi-clusterperf' --org $adir/'clusterperf.org' --full $multi_aspect })
v5=(${v4[*]/#multi-clusterperf-report/ 'render-multi-clusterperf' --report $adir/'clusterperf.report.org' --report $multi_aspect })
v5=(${v4[*]/#multi-clusterperf-report/ 'render-multi-clusterperf' --org-report $adir/'clusterperf.report.org' --report $multi_aspect })
v6=(${v5[*]/#multi-clusterperf-gnuplot/ 'render-multi-clusterperf' --gnuplot $adir/cdf/'%s.cdf' --full $multi_aspect })
v7=(${v6[*]/#multi-clusterperf-full/ 'render-multi-clusterperf' --pretty $adir/'clusterperf-full.txt' --full $multi_aspect })
v8=(${v7[*]/#multi-propagation-json/ 'render-multi-propagation' --json $adir/'blockprop.json' --full $multi_aspect })
v9=(${v8[*]/#multi-propagation-org/ 'render-multi-propagation' --org $adir/'blockprop.org' --full $multi_aspect })
va=(${v9[*]/#multi-propagation-control/ 'render-multi-propagation' --report $adir/'blockprop.forger.org' --forger $multi_aspect })
va=(${v9[*]/#multi-propagation-forger/ 'render-multi-propagation' --report $adir/'blockprop.forger.org' --forger $multi_aspect })
vb=(${va[*]/#multi-propagation-peers/ 'render-multi-propagation' --report $adir/'blockprop.peers.org' --peers $multi_aspect })
vc=(${vb[*]/#multi-propagation-endtoend/ 'render-multi-propagation' --report $adir/'blockprop.endtoend.org' --end-to-end $multi_aspect })
vd=(${vc[*]/#multi-propagation-gnuplot/ 'render-multi-propagation' --gnuplot $adir/cdf/'%s.cdf' --full $multi_aspect })
ve=(${vd[*]/#multi-propagation-full/ 'render-multi-propagation' --pretty $adir/'blockprop-full.txt' --full $multi_aspect })
vf=(${ve[*]/#compare/ 'compare' --ede nix/workbench/ede --report $adir/report-$run.org ${compares[*]} })
vg=(${vf[*]/#update/ 'compare' --ede nix/workbench/ede --report $adir/report-$run.org ${compares[*]} --template $adir/report-$run.ede })
local ops_final=(${vg[*]})
va=(${v9[*]/#multi-propagation-control/ 'render-multi-propagation' --org-report $adir/'blockprop.control.org' --control $multi_aspect })
vb=(${va[*]/#multi-propagation-forger/ 'render-multi-propagation' --org-report $adir/'blockprop.forger.org' --forger $multi_aspect })
vc=(${vb[*]/#multi-propagation-peers/ 'render-multi-propagation' --org-report $adir/'blockprop.peers.org' --peers $multi_aspect })
vd=(${vc[*]/#multi-propagation-endtoend/ 'render-multi-propagation' --org-report $adir/'blockprop.endtoend.org' --end-to-end $multi_aspect })
ve=(${vd[*]/#multi-propagation-gnuplot/ 'render-multi-propagation' --gnuplot $adir/cdf/'%s.cdf' --full $multi_aspect })
vf=(${ve[*]/#multi-propagation-full/ 'render-multi-propagation' --pretty $adir/'blockprop-full.txt' --full $multi_aspect })
vg=(${vf[*]/#compare/ 'compare' --ede nix/workbench/ede --report $adir/report-$run.org ${compares[*]} })
vh=(${vg[*]/#update/ 'compare' --ede nix/workbench/ede --report $adir/report-$run.org ${compares[*]} --template $adir/report-$run.ede })
local ops_final=(${vh[*]})

call_locli "$rtsmode" "${ops_final[@]}"

Expand Down
38 changes: 18 additions & 20 deletions nix/workbench/profile.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
usage_profile() {
usage "profile" "Cluster profile operations" <<EOF
$(yellow list \| ls) List profile names (json)
$(yellow all-profiles \| all) All profile contents (json)
$(helpcmd compose NAME..) Create a profile composed from named profiles
$(helpcmd json NAME) Get contents of either named profile, or profile JSON desc
$(helpcmd describe NAME) Print a human description of a profile
$(helpcmd node-specs PROFILE-NAME/JSON)
Print node specs JSON for the given profile and environment
$(helpcmd profile-names) List profile names (JSON)
$(blk names ls)
$(helpcmd profile-json NAME) Get contents of either named profile, or profile JSON desc
$(blk json show pj)
$(helpcmd profile-describe NAME)
$(blk describe pdesc pd) Human-readable profile overview

$(helpcmd profile-node-specs PROFILE-NAME/JSON)
$(blk node-specs specs) Print node specs JSON for the given profile and environment
$(helpcmd allocate-time PROFILE-NAME/JSON)
Allocate time for a run of a profile
Allocate time for a run of a profile
$(helpcmd describe-timing TIMING-JSON)
Explain timing allocation
Explain timing allocation
EOF
}

Expand All @@ -22,11 +24,13 @@ global_profile_eras=(
babbage
)

profile_default_op='profile-json'

profile() {
local op=${1:-show}; test $# -gt 0 && shift
local op=${1:-$profile_default_op}; test $# -gt 0 && shift

case "$op" in
list | names | ls )
profile-names | names | list | lsp )
profile generate-all | jq 'keys'
;;

Expand All @@ -36,12 +40,6 @@ case "$op" in
| add
';;

all-profile-names | names | all-names )
with_era_profiles '
map (generate_all_era_profiles(.; null; null) | map(.name))
| add
';;

has-profile )
local usage="USAGE: wb profile $op NAME"
local name=${1:?$usage}
Expand All @@ -66,7 +64,7 @@ case "$op" in
| add
';;

json | show )
profile-json | json | show | pj )
local usage="USAGE: wb profile $op [NAME=<current-shell-profile>"
local name=${1:-${WB_SHELL_PROFILE:?variable unset, no profile name to use as a default.}}

Expand All @@ -83,7 +81,7 @@ case "$op" in
else jq '. * $overlay[0]' <<<$json --slurpfile overlay $preset_overlay
fi;;

describe )
profile-describe | describe | pdesc | pd )
local usage="USAGE: wb profile $op NAME"
local name=${1:?$usage}

Expand Down Expand Up @@ -116,7 +114,7 @@ case "$op" in
else echo "$path"
fi;;

node-specs )
profile-node-specs | node-specs | specs )
local usage="USAGE: wb profile $op PROFILE-NAME/JSON"
local profile=${1:?$usage}

Expand Down
3 changes: 0 additions & 3 deletions nix/workbench/profiles/prof1-variants.jq
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
## Profile variants are defined as a cartesian product of
## variations of genesis/generator/node axes.

def all_profile_variants:
1024 as $Ki
| 1000000 as $M
Expand Down
108 changes: 59 additions & 49 deletions nix/workbench/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,30 @@ global_rundir_def=$(realpath ${WB_RUNDIR:-$PWD/run})

usage_run() {
usage "run" "Managing cluster runs" <<EOF
$(helpcmd list) List cluster runs
$(blk ls)
$(helpcmd list-sets) List cluster run sets
$(blk lss)
$(helpcmd list-runs) List local runs
$(blk runs lsr)
$(helpcmd list-remote) List AWS runs
$(blk remote lsrr)
$(helpcmd list-verbose) List local runs, verbosely
$(blk verb lsrv)
$(helpcmd list-verbose-remote) List AWS runs, verbosely
$(blk rverb lsrvr)
$(helpcmd list-sets) List local run sets
$(blk sets lss)
$(helpcmd list-sets-remote) List AWS cluster run sets
$(blk rsets lssr)
$(helpcmd set-add SETNAME RUN...)
$(blk sa) Add runs to the named run set
$(helpcmd run-or-set) Resolve a run-or-set name to a list of runs
$(blk add sa) Add runs to the named run set
$(helpcmd run-or-set) Resolve a run-or-set name to a list of runs
$(blk ros)
$(helpcmd list-pattern) List local runs
$(blk lspat lsrp)

$(helpcmd describe RUN)

$(helpcmd fix-legacy-run-structure RUN)
$(blk flrs fix-legacy) Update legacy (AWS) meta.json to mostly match
the workbench

$(helpcmd allocate BATCH-NAME PROFILE-NAME [ENV-CONFIG-OPTS..])
Allocate a cluster run with the specified:
Expand All @@ -18,19 +34,11 @@ usage_run() {
A unique name would be allocated for this run,
and a run alias $(green current) will be created for it.

$(helpcmd list-remote) List AWS runs
$(blk lsaws lsr)
$(helpcmd fetch-run RUN)
Fetch an AWS run
$(blk fetch fr)
$(helpcmd fetch-run RUN) Fetch an AWS run
$(blk fr fetch)
$(helpcmd fetch-analysis RUN..)
$(blk fa) Fetch analyses of AWS runs
$(helpcmd analyse-aws RUN..) Run analyses of AWS runs, remotely
$(helpcmd fix-legacy-run-structure RUN)
$(blk fix-legacy flrs) Update legacy (AWS) meta.json to mostly match
the workbench

$(helpcmd describe RUN)

$(helpcmd start [--scenario NAME] [--idle] [--analyse] RUN)
Start the named run.
Expand All @@ -53,6 +61,8 @@ usage_run() {
EOF
}

run_default_op='list-runs'

run() {
set -eu
if test -v "WB_RUNDIR" && test -d "$WB_RUNDIR"
Expand All @@ -76,13 +86,13 @@ do case "$1" in
--clean | -c ) sargs+=($1); run_aws_get_args+=($1);;
* ) break;; esac; shift; done

local op=${1:-list}; test $# -gt 0 && shift
local op=${1:-$run_default_op}; test $# -gt 0 && shift

case "$op" in
get-rundir )
echo $global_rundir;;

list | ls )
list-runs | runs | lsr )
local usage="USAGE: wb run $op [--on-remote | -or | -r]"
local on_remote=
while test $# -gt 0
Expand All @@ -98,10 +108,10 @@ case "$op" in
sh -c "'$(run_ls_cmd $(jq <<<$r .depl)/runs)'"
fi;;

list-remote | lsaws | lsr ) ## Convenience alias for 'list'
list-remote | remote | lsrr ) ## Convenience alias for 'list'
run "${sargs[@]}" list --on-remote;;

list-verbose | tab | lst )
list-verbose | verb | lsrv )
local usage="USAGE: wb run $op [--on-remote | -or | -r] [--limit [N=10] | -n N]"
local on_remote= limit=10
while test $# -gt 0
Expand All @@ -118,10 +128,10 @@ case "$op" in
sh -c "'$(run_ls_tabulated_cmd $(jq <<<$r .depl)/runs $limit)'"
fi;;

list-verbose-remote | lstaws | tabr | lsvr | lstr ) ## Convenience alias for 'list-verbose'
list-verbose-remote | rverb | lsrvr ) ## Convenience alias for 'list-verbose'
run "${sargs[@]}" list-verbose --on-remote;;

list-sets | lss )
list-sets | sets | lss )
local usage="USAGE: wb run $op [--on-remote | -or | -r]"
local on_remote=
while test $# -gt 0
Expand All @@ -137,10 +147,10 @@ case "$op" in
sh -c "'$(run_ls_sets_cmd $(jq <<<$r .depl)/runs)'"
fi;;

list-sets-remote | lssr ) ## Convenience alias for 'list-sets'
list-sets-remote | rsets | lssr ) ## Convenience alias for 'list-sets'
run "${sargs[@]}" list-sets --on-remote;;

set-add | sa )
set-add | add | sa )
local usage="USAGE: wb run $op NAME [RUN..]"
local name=${1:?$usage}; shift
mkdir -p "$global_rundir/.sets/$name" &&
Expand Down Expand Up @@ -189,19 +199,31 @@ case "$op" in
else fail "run-or-set: missing run or set $(white $name)"
fi;;

list-pattern | lsp )
list-pattern | lspat | lsrp )
test -d "$global_rundir" &&
(cd "$global_rundir"
ls $1/meta.json |
grep -v 'current$\|deploy-logs$' |
cut -d/ -f1 |
sort || true);;

compute-path )
if test -f "$1/meta.json"
then echo -n "$1"
else echo -n "$global_rundir/$1"
fi;;
describe )
local usage="USAGE: wb run $op RUN"
local run=${1:?$usage}
local dir=$global_rundir/$run

if ! run check "$run"
then fatal "run fails sanity checks: $run at $dir"; fi

cat <<EOF
- run dir: $dir
- profile JSON: $dir/profile.json
- node specs: $dir/node-specs.json
- topology: $dir/topology/topology.pdf
- node base port: $(envjq 'basePort')
EOF
backend describe-run "$dir"
;;

fix-legacy-run-structure | fix-legacy | flrs )
local usage="USAGE: wb run $op RUN"
Expand Down Expand Up @@ -245,6 +267,12 @@ case "$op" in
end)
' "$dir"/meta.json > "$dir"/profile.json;;

compute-path )
if test -f "$1/meta.json"
then echo -n "$1"
else echo -n "$global_rundir/$1"
fi;;

check )
local usage="USAGE: wb run $op [--query] RUN"
local query=
Expand Down Expand Up @@ -680,24 +708,6 @@ case "$op" in
| .staking = {}
' "$genesis_orig"; fi;;

describe )
local usage="USAGE: wb run $op RUN"
local run=${1:?$usage}
local dir=$global_rundir/$run

if ! run check "$run"
then fatal "run fails sanity checks: $run at $dir"; fi

cat <<EOF
- run dir: $dir
- profile JSON: $dir/profile.json
- node specs: $dir/node-specs.json
- topology: $dir/topology/topology.pdf
- node base port: $(envjq 'basePort')
EOF
backend describe-run "$dir"
;;

compat-meta-fixups | compat-f )
local usage="USAGE: wb run $op RUN"
local run=${1:?$usage}
Expand Down Expand Up @@ -960,7 +970,7 @@ run_ls_tabulated_cmd() {
run_ls_sets_cmd() {
local rundir=$1

echo 'cd '$rundir'/.sets && \
echo 'cd '$rundir'/.sets 2>/dev/null && \
find -L . -mindepth 3 -maxdepth 3 -type f -name meta.json -exec dirname \{\} \; |
cut -d/ -f2 |
sort -u || true'
Expand Down
Loading