From 5c35c242d8ee03b4763aadad7c3a4b30c302abb8 Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Fri, 13 Sep 2024 20:03:21 +0000 Subject: [PATCH] wb | flake output with cloud profiles data --- bench/cardano-profile/app/cardano-profile.hs | 17 ++++++- .../src/Cardano/Benchmarking/Profile.hs | 6 ++- flake.nix | 2 +- nix/pkgs.nix | 45 +++++++++++++++++++ 4 files changed, 67 insertions(+), 3 deletions(-) diff --git a/bench/cardano-profile/app/cardano-profile.hs b/bench/cardano-profile/app/cardano-profile.hs index fc0cec66d1b..b38760e4739 100644 --- a/bench/cardano-profile/app/cardano-profile.hs +++ b/bench/cardano-profile/app/cardano-profile.hs @@ -16,7 +16,14 @@ import qualified Cardano.Benchmarking.Profile.Types as Types -------------------------------------------------------------------------------- -data Cli = Names | All | ByName String | LibMK | ToJson String | FromJson String +data Cli = + Names + | NamesCloudNoEra + | All + | ByName String + | LibMK + | ToJson String + | FromJson String -------------------------------------------------------------------------------- @@ -26,6 +33,8 @@ main = do case cli of -- Print all profile names. Names -> BSL8.putStrLn $ Aeson.encode Profiles.names + -- Print all cloud profile (-nomadperf) names. + NamesCloudNoEra -> BSL8.putStrLn $ Aeson.encode Profiles.namesCloudNoEra -- Print a map with all profiles, with an optional overlay. All -> do obj <- lookupOverlay @@ -76,6 +85,12 @@ cliParser = OA.hsubparser $ (pure Names) (OA.fullDesc <> OA.header "names" <> OA.progDesc "All profiles names") ) + <> + OA.command "names-cloud-noera" + (OA.info + (pure NamesCloudNoEra) + (OA.fullDesc <> OA.header "names" <> OA.progDesc "All cloud profiles names (no era suffix)") + ) <> OA.command "all" (OA.info diff --git a/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs b/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs index 1b35497ccd1..76006336044 100644 --- a/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs +++ b/bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs @@ -4,7 +4,7 @@ -------------------------------------------------------------------------------- module Cardano.Benchmarking.Profile ( - names, namesNoEra + names, namesNoEra, namesCloudNoEra , byName , profiles , libMk @@ -51,6 +51,10 @@ names :: [String] -- Overlay not supported here, using an empty overlay. names = Map.keys (profiles mempty) +namesCloudNoEra :: [String] +-- Overlay not supported here, using an empty overlay. +namesCloudNoEra = map Types.name profilesNoEraCloud + -- Names: -- wb profile all-profiles | jq .[] | jq -r .name | sort | uniq | grep "\-bage" namesNoEra :: [String] diff --git a/flake.nix b/flake.nix index 4052b906485..045555f7bc5 100644 --- a/flake.nix +++ b/flake.nix @@ -211,7 +211,7 @@ workbenchStartArgs = [ "--create-testnet-data" "--trace" ]; }; - inherit (pkgs) all-profiles-json; + inherit (pkgs) all-profiles-json profile-data-nomadperf; system-tests = pkgs.writeShellApplication { name = "system-tests"; diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 304c6824429..1228fda671f 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -128,6 +128,51 @@ in with final; all-profiles-json = workbench.profile-names-json; + # The profile data and backend data of the cloud / "*-nomadperf" profiles. + # Useful to mix workbench and cardano-node commits, mostly because of scripts. + profile-data-nomadperf = builtins.listToAttrs ( + builtins.map + (cloudName: + # Only Conway era cloud profiles are flake outputs. + let profileName = "${cloudName}-coay"; + in { + name = profileName; + value = + let + # Default values only ("run/current", 30000, profiling "none"). + profile = workbench.profile { + inherit profileName; + inherit (customConfig) profiling; + }; + backend = workbench.backend + { backendName = "nomadcloud"; + stateDir = customConfig.localCluster.stateDir; + basePort = customConfig.localCluster.basePort; + useCabalRun = customConfig.localCluster.useCabalRun; + } + ; + profileData = profile.materialise-profile + { inherit backend; } + ; + backendData = backend.materialise-profile {inherit profileData;}; + in pkgs.runCommand "workbench-data-${profileName}" {} + '' + mkdir $out + ln -s ${profileData} $out/profileData + ln -s ${backendData} $out/backendData + '' + ; + } + ) + # Fetch all "*-nomadperf" profiles. + (__fromJSON (__readFile + (pkgs.runCommand "cardano-profile-names-cloud-noera" {} '' + ${cardanoNodePackages.cardano-profile}/bin/cardano-profile names-cloud-noera > $out + '' + ) + )) + ); + # Disable failing python uvloop tests python39 = prev.python39.override { packageOverrides = pythonFinal: pythonPrev: {