Skip to content

Commit

Permalink
Merge #4113
Browse files Browse the repository at this point in the history
4113: workbench: fixes r=deepfire a=deepfire

- fix the `hydra-build-products`
- add the `workbench-shell` to CI
- small quality-of-life improvements

Co-authored-by: Kosyrev Serge <serge.kosyrev@iohk.io>
  • Loading branch information
iohk-bors[bot] and deepfire committed Jun 29, 2022
2 parents ab2caac + 68b1b9e commit c388388
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 88 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ ARGS ?=
CMD ?=
RUN ?=

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

stylish-haskell: ## Apply stylish-haskell on all *.hs files
Expand Down
1 change: 0 additions & 1 deletion bench/locli/locli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ library
, ouroboros-consensus
-- for Data.SOP.Strict:
, ouroboros-network
, perf
, process
, quiet
, scientific
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@

shell = import ./shell.nix { inherit pkgs customConfig cardano-mainnet-mirror; };
devShells = {
inherit (shell) devops;
inherit (shell) devops workbench-shell;
cluster = shell;
profiled = project.profiled.shell;
};
Expand Down
3 changes: 2 additions & 1 deletion nix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ membench-5-at: ## Membench: 5 iterations, set commit by: make membench-5-at RE
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}

workbench-ci-test smoke: ## Workbench: test a-la Hydra, the ci-test profile, full Nix engaged
nix build '.#hydraJobsPr.linux.native.workbench-ci-test' --cores 0 --out-link result-ci-test
nix build --out-link result-ci-test '.#hydraJobsPr.linux.native.workbench-ci-test' --cores 0
mv result-ci-test run/`jq -r .meta.tag result-ci-test/meta.json`
10 changes: 6 additions & 4 deletions nix/workbench/profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ case "$op" in

all-profiles | generate-all | all )
with_era_profiles '
map (profiles(.; null; null; []))
map (generate_all_era_profiles(.; null; null))
| add
';;

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

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

with_era_profiles '
map (has_profile(.; null; null; []; $name))
map (generate_all_era_profiles(.; null; null)
| map (.name == $name)
| any)
| any
' --exit-status --arg name "$name" >/dev/null
;;
Expand Down Expand Up @@ -84,7 +86,7 @@ case "$op" in
local name=${1:?$usage}

profile json $name |
jq 'include "derived";
jq 'include "prof2-derived";
profile_pretty_describe(.)
' --raw-output -L "$global_basedir/profiles" -L "$global_basedir";;
Expand Down
20 changes: 0 additions & 20 deletions nix/workbench/profiles/adhoc.jq

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Testable with:
##
## jq -n 'include "defaults" { search: "nix/workbench/profiles" }; era_defaults("babbage")'
## jq -n 'include "prof0-defaults" { search: "nix/workbench/profiles" }; era_defaults("babbage")'
##
def era_defaults($era):
{ common:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,24 @@ def all_profile_variants:
, $scenario_chainsync * $chaindb_early_alonzo * $p2p *
{ name: "chainsync-early-alonzo-p2p"
}

## Last, but not least, the profile used by "nix-shell -A devops":
, { name: "devops"
, scenario: "idle"
, genesis:
{ slot_duration: 0.2
, parameter_k: 10
, epoch_length: 1000
, active_slots_coeff: 0.1
, genesis_future_offset: "10 seconds"
, utxo: 0

, shelley:
{ updateQuorum: 1
}
}
, analysis:
{ type: null
}
}
];
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include "defaults";
include "prof0-defaults";
include "genesis";
include "lib";

Expand Down
71 changes: 43 additions & 28 deletions nix/workbench/profiles/profiles.jq
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
## - era-dependent defaults for the aforementioned sections:
## - profiles/defaults.jq
##
## - overlaid with generated profile variants + ad-hoc profiles:
## - profiles/variants.jq and profiles/adhoc.jq
## - overlaid with generated profile variants (including adhoc profiles):
## - profiles/variants.jq
##
## - each then further overlaid with derived parameters, computed from the above:
## - profiles/derived.jq
Expand Down Expand Up @@ -58,39 +58,54 @@
## ..which simply calls ./profiles.nix with {} params.
##

include "topology";
include "defaults";
include "adhoc";
include "variants";
include "derived";
include "prof0-defaults";
include "prof1-variants";
include "prof2-derived";

def compute_profiles($era; $mcompo; $topo; $extra_profiles):
## Cluster composition is an extract from the topology,
## that classifies nodes into BFT, regular pools and dense pools,
## based on the 'pools' field.
##
## Testable with:
##
## jq -n 'include "composition" { search: "nix/workbench/profiles" }; topology_composition({ coreNodes: { bft1: { pools: 0 } } })'
##
def topology_composition($topo):
$topo
| (.Producers // .coreNodes // {})
| to_entries
| map (.value.pools // 0)
| length as $n_hosts
| map (select (. == 0)) as $bfts
| map (select (. != 0)) as $pools
| ($pools | map (select (. == 1))) as $singular_pools
| ($pools | map (select (. > 1))) as $dense_pools
| ($singular_pools | length) as $n_singular_hosts
| { n_bft_hosts: ($bfts | length)
, n_singular_hosts: ($singular_pools | length)
, n_dense_hosts: ($dense_pools | length)
};

##
## This is the workbench's entry point for everything profile.
##
## generate_all_era_profiles :: Era -> Maybe Composition -> Topology -> Map Name Profile
##
def generate_all_era_profiles($era; $mcompo; $topo):
($mcompo // topology_composition($topo // {}) // {}) as $compo

## Profiles are variants + custom (or aux) profiles:
| all_profile_variants + adhoc_profiles + $extra_profiles
| map (## Each profile extends defaults:
era_defaults($era) * .
| all_profile_variants
| map (## Each profile is defined as extension of defaults:
era_defaults($era) ## prof0-defaults.jq
* . ## prof1-variants.jq

## Profiles can define their own cluster composition.
## Profiles define their own cluster composition:
| . * { composition: (.composition // $compo) }

## Compute the derived params.
| add_derived_params
);

def profiles($era; $mcompo; $topo; $extra_profiles):
compute_profiles($era; $mcompo; $topo; $extra_profiles)
## Finally, compute the derived ("computed") params.
| add_derived_params ## prof2-derived.jq
)
| map (## Assemble into a dictionary..
{ "\(.name)": .
})
| add;

def profile_names($era; $mcompo; $topo; $extra_profiles):
compute_profiles($era; $mcompo; $topo; $extra_profiles)
| map (.name);

def has_profile($era; $mcompo; $topo; $extra_profiles; $name):
compute_profiles($era; $mcompo; $topo; $extra_profiles)
| map (.name == $name)
| any;
23 changes: 0 additions & 23 deletions nix/workbench/profiles/topology.jq

This file was deleted.

13 changes: 6 additions & 7 deletions nix/workbench/supervisor-run.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ let
echo "workbench: alternate command for this action: wb run restart" >&2
'';

nodeBuildProducts =
nodeBuildProduct =
name:
"report ${name}.log $out ${name}/stdout";
"report ${name}-log $out ${name}/stdout";

profile-run =
{ trace ? false }:
Expand Down Expand Up @@ -134,12 +134,11 @@ let
rmdir run/$tag run
cat > $out/nix-support/hydra-build-products <<EOF
report workbench.log $out wb-start.log
report meta.json $out meta.json
report workbench-log $out wb-start.log
report meta $out meta.json
${pkgs.lib.concatStringsSep "\n"
(map nodeBuildProducts (__attrNames profileNix.node-specs.value))}
report node-0 $out meta.json
report archive.tar.zst $out archive.tar.zst
(map nodeBuildProduct (__attrNames profileNix.node-specs.value))}
report archive-tar-zst $out archive.tar.zst
EOF
echo "workbench-test: completed run $tag"
Expand Down

0 comments on commit c388388

Please sign in to comment.