22
33--------------------------------------------------------------------------------
44
5+ -- base.
56import Prelude
6-
7- import Data.Bool (bool )
87import System.Environment (lookupEnv )
98import GHC.Stack (HasCallStack )
109-- Package: aeson.
@@ -24,61 +23,64 @@ import qualified Cardano.Benchmarking.Profile.NodeSpecs as NodeSpecs
2423import qualified Cardano.Benchmarking.Profile.Types as Types
2524-- Profiles to export!
2625-- Static / built-in / profiles part of the test-suite.
27- import Cardano.Benchmarking.Profile.Builtin.Cloud (profilesNoEraCloud )
28- import Cardano.Benchmarking.Profile.Builtin.Empty (profilesNoEraEmpty )
29- import Cardano.Benchmarking.Profile.Builtin.ForgeStress (profilesNoEraForgeStress )
30- import Cardano.Benchmarking.Profile.Builtin.K3 (profilesNoEraK3 )
31- import Cardano.Benchmarking.Profile.Builtin.Legacy.Dense (profilesNoEraDense )
32- import Cardano.Benchmarking.Profile.Builtin.Legacy.Dish (profilesNoEraDish )
33- import Cardano.Benchmarking.Profile.Builtin.Miniature (profilesNoEraMiniature )
34- import Cardano.Benchmarking.Profile.Builtin.Model (profilesNoEraModel )
35- import Cardano.Benchmarking.Profile.Builtin.Plutuscall (profilesNoEraPlutuscall )
36- import Cardano.Benchmarking.Profile.Builtin.Scenario.Chainsync (profilesNoEraChainsync )
37- import Cardano.Benchmarking.Profile.Builtin.Scenario.Idle (profilesNoEraIdle )
38- import Cardano.Benchmarking.Profile.Builtin.Scenario.TracerOnly (profilesNoEraTracerOnly )
39- import Cardano.Benchmarking.Profile.Extra.Scaling (profilesNoEraScalingLocal , profilesNoEraScalingCloud )
26+ import Cardano.Benchmarking.Profile.Builtin.Cloud (profilesCloud )
27+ import Cardano.Benchmarking.Profile.Builtin.Empty (profilesEmpty )
28+ import Cardano.Benchmarking.Profile.Builtin.ForgeStress (profilesForgeStress )
29+ import Cardano.Benchmarking.Profile.Builtin.K3 (profilesK3 )
30+ import Cardano.Benchmarking.Profile.Builtin.Legacy.Dense (profilesDense )
31+ import Cardano.Benchmarking.Profile.Builtin.Legacy.Dish (profilesDish )
32+ import Cardano.Benchmarking.Profile.Builtin.Miniature (profilesMiniature )
33+ import Cardano.Benchmarking.Profile.Builtin.Model (profilesModel )
34+ import Cardano.Benchmarking.Profile.Builtin.Plutuscall (profilesPlutuscall )
35+ import Cardano.Benchmarking.Profile.Builtin.Scenario.Chainsync (profilesChainsync )
36+ import Cardano.Benchmarking.Profile.Builtin.Scenario.Idle (profilesIdle )
37+ import Cardano.Benchmarking.Profile.Builtin.Scenario.TracerOnly (profilesTracerOnly )
38+ import Cardano.Benchmarking.Profile.Extra.Scaling (profilesScalingLocal , profilesScalingCloud )
4039-- Dynamic profiles.
41- import Cardano.Benchmarking.Profile.Playground (profilesNoEraPlayground )
40+ import Cardano.Benchmarking.Profile.Playground (profilesPlayground )
4241
4342--------------------------------------------------------------------------------
4443
4544allProfiles :: [Types. Profile ]
4645allProfiles = performanceAndTracingProfiles ++ playgroundProfiles
4746
4847cloudProfiles :: [Types. Profile ]
49- cloudProfiles = profilesNoEraCloud
48+ cloudProfiles = profilesCloud
5049
5150-- "families" of profiles. Grouped by common properties or intentions.
5251performanceAndTracingProfiles :: [Types. Profile ]
5352performanceAndTracingProfiles =
5453 cloudProfiles
55- ++ profilesNoEraEmpty -- Empty datasets running `FixedLoaded`.
56- ++ profilesNoEraForgeStress -- All the "forge-stress*" profiles.
57- ++ profilesNoEraK3 -- K3
54+ -- Empty datasets running `FixedLoaded`.
55+ ++ profilesEmpty
56+ -- All the "forge-stress*" profiles.
57+ ++ profilesForgeStress
58+ -- K3.
59+ ++ profilesK3
5860 -- Legacy.
59- ++ profilesNoEraDense
60- ++ profilesNoEraDish
61- ++ profilesNoEraMiniature
62- ++ profilesNoEraModel --
63- ++ profilesNoEraPlutuscall --
61+ ++ profilesDense
62+ ++ profilesDish
63+ -- Light dataset.
64+ ++ profilesMiniature
65+ ++ profilesModel
66+ ++ profilesPlutuscall
6467 -- Empty datasets not running `FixedLoaded`.
65- ++ profilesNoEraChainsync -- Scenario `Chainsync`
66- ++ profilesNoEraIdle -- Scenario `Idle`
67- ++ profilesNoEraTracerOnly -- Scenario `TracerOnly`
68- -- Extra modules
69- ++ profilesNoEraScalingLocal
70- ++ profilesNoEraScalingCloud
68+ ++ profilesChainsync -- Scenario `Chainsync`
69+ ++ profilesIdle -- Scenario `Idle`
70+ ++ profilesTracerOnly -- Scenario `TracerOnly`
71+ -- Extra profiles.
72+ ++ profilesScalingLocal
73+ ++ profilesScalingCloud
7174
7275-- Have fun!
7376playgroundProfiles :: [Types. Profile ]
74- playgroundProfiles = profilesNoEraPlayground
77+ playgroundProfiles = profilesPlayground
7578
7679--------------------------------------------------------------------------------
7780
7881data Cli =
79- NamesNoEra
80- | NamesCloudNoEra
81- | Names
82+ Names
83+ | NamesCloud
8284 | All [CliOptions ]
8385 | ByName [CliOptions ] String
8486 | LibMK
@@ -89,13 +91,13 @@ data Cli =
8991
9092data CliOptions =
9193 OptPrettyPrint
92- | OptWithEra
9394 | OptWithPlayground
9495 deriving Eq
9596
9697--------------------------------------------------------------------------------
9798
98- -- | Construct Map with profile name as key, without eras (in name and object).
99+ -- | Construct Map of `Profile` with the key being the profile name after
100+ -- applying an optional overlay.
99101toMap :: HasCallStack => Maybe Aeson. Object -> [Types. Profile ] -> Map. Map String Types. Profile
100102toMap maybeObj ps = Map. fromList $ map
101103 (\ p ->
@@ -125,28 +127,27 @@ main :: IO ()
125127main = do
126128 cli <- getOpts
127129 case cli of
128- -- Print all profile names without the era suffix (does not apply overlays).
129- NamesNoEra -> BSL8. putStrLn $ Aeson. encode $ map Types. name allProfiles
130- -- Print all cloud profile (-nomadperf) names (does not apply overlays).
131- NamesCloudNoEra -> BSL8. putStrLn $ Aeson. encode $ map Types. name cloudProfiles
132- -- Print all profile names (applies overlays!!!!!).
130+ -- Print all profile names, with an optional overlay.
133131 Names -> do
134- maybeObj <- lookupOverlay -- Ignored by `NamesNoEra` and `NamesCloudNoEra`.
135- BSL8. putStrLn $ Aeson. encode $ Map. keys $ Profile. addEras $ toMap maybeObj allProfiles
132+ maybeObj <- lookupOverlay -- Ignored by `NamesCloud`.
133+ BSL8. putStrLn $ Aeson. encode $ Map. keys $ toMap maybeObj allProfiles
134+ -- Print all cloud (-nomadperf) profile names, does not apply overlays.
135+ NamesCloud -> BSL8. putStrLn $ Aeson. encode $ map Types. name cloudProfiles
136136 -- Print a map with all profiles, with an optional overlay.
137137 All cliOptions -> do
138138 let
139- targetProfiles = if OptWithPlayground `elem` cliOptions then allProfiles else performanceAndTracingProfiles
139+ targetProfiles = if OptWithPlayground `elem` cliOptions
140+ then allProfiles
141+ else performanceAndTracingProfiles
140142 enc = encoder cliOptions
141- withEraSuffs = OptWithEra `elem` cliOptions
142- maybeObj <- lookupOverlay -- Ignored by `NamesNoEra` and `NamesCloudNoEra`.
143- BSL8. putStrLn $ enc $ bool id Profile. addEras withEraSuffs $ toMap maybeObj targetProfiles
143+ maybeObj <- lookupOverlay -- Ignored by `NamesCloud`.
144+ BSL8. putStrLn $ enc $ toMap maybeObj targetProfiles
144145 -- Print a single profiles, with an optional overlay.
145146 ByName cliOptions profileName -> do
146- maybeObj <- lookupOverlay -- Ignored by `NamesNoEra` and `NamesCloudNoEra `.
147+ maybeObj <- lookupOverlay -- Ignored by `NamesCloud `.
147148 let
148149 enc = encoder cliOptions
149- profiles = Profile. addEras $ toMap maybeObj allProfiles
150+ profiles = toMap maybeObj allProfiles
150151 case Map. lookup profileName profiles of
151152 Nothing -> error $ " No profile named \" " ++ profileName ++ " \" "
152153 Just profile -> BSL8. putStrLn $ enc profile
@@ -199,40 +200,28 @@ getOpts = OA.execParser $
199200
200201cliParser :: OA. Parser Cli
201202cliParser = OA. hsubparser $
202- OA. command " names-noera"
203- (OA. info
204- (pure NamesNoEra )
205- (OA. fullDesc <> OA. header " names-noera" <> OA. progDesc " All profiles names (no era suffix)" )
206- )
207- <>
208- OA. command " names-cloud-noera"
209- (OA. info
210- (pure NamesCloudNoEra )
211- (OA. fullDesc <> OA. header " names-cloud-noera" <> OA. progDesc " All cloud profiles names (no era suffix)" )
212- )
213- <>
214203 OA. command " names"
215204 (OA. info
216205 (pure Names )
217206 (OA. fullDesc <> OA. header " names" <> OA. progDesc " All profiles names" )
218207 )
219208 <>
220- OA. command " all "
209+ OA. command " names-cloud "
221210 (OA. info
222- (pure $ All [ OptWithEra , OptWithPlayground ] )
223- (OA. fullDesc <> OA. header " all " <> OA. progDesc " Create all profiles" )
211+ (pure NamesCloud )
212+ (OA. fullDesc <> OA. header " names-cloud " <> OA. progDesc " All cloud profiles names " )
224213 )
225214 <>
226- OA. command " all-noera "
215+ OA. command " all"
227216 (OA. info
228217 (pure $ All [OptWithPlayground ])
229- (OA. fullDesc <> OA. header " all-noera " <> OA. progDesc " Create all profiles (no era suffix) " )
218+ (OA. fullDesc <> OA. header " all" <> OA. progDesc " Create all profiles" )
230219 )
231220 <>
232- OA. command " allpt-noera "
221+ OA. command " allpt"
233222 (OA. info
234223 (pure $ All [OptPrettyPrint ])
235- (OA. fullDesc <> OA. header " allpt-noera " <> OA. progDesc " Create P&T profiles (no era suffix) " )
224+ (OA. fullDesc <> OA. header " allpt" <> OA. progDesc " Create P&T profiles" )
236225 )
237226 <>
238227 OA. command " by-name"
@@ -289,28 +278,28 @@ libMKLocations =
289278 -- Local profiles.
290279 (" LOCAL_PROFILES" , [
291280 -- Families of local profiles.
292- (" PROFILES_EMPTY" , profilesNoEraEmpty )
293- , (" PROFILES_MINIATURE" , profilesNoEraMiniature )
294- , (" PROFILES_FORGE_STRESS" , profilesNoEraForgeStress )
295- , (" PROFILES_PLUTUSCALL" , profilesNoEraPlutuscall )
296- , (" PROFILES_MODEL" , profilesNoEraModel )
297- , (" PROFILES_K3" , profilesNoEraK3 )
281+ (" PROFILES_EMPTY" , profilesEmpty )
282+ , (" PROFILES_MINIATURE" , profilesMiniature )
283+ , (" PROFILES_FORGE_STRESS" , profilesForgeStress )
284+ , (" PROFILES_PLUTUSCALL" , profilesPlutuscall )
285+ , (" PROFILES_MODEL" , profilesModel )
286+ , (" PROFILES_K3" , profilesK3 )
298287 , (" PROFILES_SCENARIOS" ,
299- profilesNoEraChainsync
300- ++ profilesNoEraIdle
301- ++ profilesNoEraTracerOnly
288+ profilesChainsync
289+ ++ profilesIdle
290+ ++ profilesTracerOnly
302291 )
303292 , (" PROFILES_LEGACY" ,
304- profilesNoEraDense
305- ++ profilesNoEraDish
293+ profilesDense
294+ ++ profilesDish
306295 )
307- , (" PROFILES_SCALING" , profilesNoEraScalingLocal )
296+ , (" PROFILES_SCALING" , profilesScalingLocal )
308297 ])
309298 -- Cloud profiles.
310299 , (" CLOUD_PROFILES" , [
311300 -- Families of cloud profiles.
312- (" PROFILES_NOMAD_PERF" , profilesNoEraCloud )
313- , (" PROFILES_NOMAD_PERFSSD" , profilesNoEraScalingCloud )
301+ (" PROFILES_NOMAD_PERF" , profilesCloud )
302+ , (" PROFILES_NOMAD_PERFSSD" , profilesScalingCloud )
314303 ])
315304 ]
316305
0 commit comments