Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaste committed Jun 3, 2024
1 parent 27016e7 commit 18ead58
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
12 changes: 9 additions & 3 deletions bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module Cardano.Benchmarking.Profile (
-- Cluster params.
, clusterMinimunStorage, clusterKeepRunningOn
, nomadNamespace, nomadClass, nomadResources, nomadSSHLogsOn
, awsInstanceTypes
, awsInstanceTypes, usePublicRouting

-- Analysis params.
, analysisOff, analysisStandard, analysisPerformance
Expand Down Expand Up @@ -170,13 +170,15 @@ empty = Types.Profile {
Types.producer = Types.Resources 0 0 0
, Types.explorer = Just $ Types.Resources 0 0 0
}
, Types.host_volumes = Nothing
, Types.fetch_logs_ssh = False
}
, Types.aws = Types.ClusterAWS {
Types.instance_type = Types.ByNodeType {
Types.producer = ""
, Types.explorer = Nothing
}
, Types.use_public_routing = False
}
, Types.minimun_storage = Just $ Types.ByNodeType {
Types.producer = 0
Expand Down Expand Up @@ -227,6 +229,7 @@ empty = Types.Profile {
, Types.createTestnetDataArgs = []
, Types.pools = []
}
, Types.overlay = mempty
}

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -516,6 +519,9 @@ aws f p = cluster (\c -> c {Types.aws = f (Types.aws c)}) p
awsInstanceTypes :: (Types.ByNodeType String) -> Types.Profile -> Types.Profile
awsInstanceTypes i = aws (\n -> n {Types.instance_type = i})

usePublicRouting :: Types.Profile -> Types.Profile
usePublicRouting = aws (\n -> n {Types.use_public_routing = True})

-- Analysis.
--------------------------------------------------------------------------------

Expand Down Expand Up @@ -622,7 +628,7 @@ unionWithKey _ (Aeson.Object a) (Aeson.Object b) =
unionWithKey _ _ b = b

derive :: Types.Profile -> Types.Profile
derive p@(Types.Profile _ _ _ comp _era gsis n gtor _ _ ana _ _) =
derive p@(Types.Profile _ _ _ comp _era gsis n gtor _ _ ana _ _ _) =
let
-- Absolute/epoch durations:
----------------------------
Expand Down Expand Up @@ -805,7 +811,7 @@ derive p@(Types.Profile _ _ _ comp _era gsis n gtor _ _ ana _ _) =
--}

cliArgs :: Types.Profile -> Types.Profile
cliArgs p@(Types.Profile _ _ _ comp __ gsis _ _ _ _ _ dved _) =
cliArgs p@(Types.Profile _ _ _ comp __ gsis _ _ _ _ _ dved _ _) =
let --toJson = map (\(k,n) -> )
fmtDecimal i =
(Scientific.formatScientific Scientific.Fixed (Just 0) ((fromInteger i) / 100000))
Expand Down
6 changes: 6 additions & 0 deletions bench/cardano-profile/src/Cardano/Benchmarking/Profile/Map.hs
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,8 @@ nomadPerf =
, Types.explorer = Just "m5.4xlarge"
})
.
P.usePublicRouting
.
P.clusterMinimunStorage (Just $ Types.ByNodeType {
Types.producer = 12582912
, Types.explorer = Just 14155776
Expand Down Expand Up @@ -686,6 +688,8 @@ clusterNomadSsd =
, Types.explorer = Just "r5d.4xlarge"
})
.
P.usePublicRouting
.
P.clusterMinimunStorage Nothing

clusterDefault :: Types.Profile -> Types.Profile
Expand All @@ -699,13 +703,15 @@ clusterDefault p =
Types.producer = Types.Resources 2 15000 16000
, Types.explorer = Just $ Types.Resources 2 15000 16000
}
, Types.host_volumes = Nothing
, Types.fetch_logs_ssh = False
}
, Types.aws = Types.ClusterAWS {
Types.instance_type = Types.ByNodeType {
Types.producer = "c5.2xlarge"
, Types.explorer = Just "m5.4xlarge"
}
, Types.use_public_routing = False
}
, Types.minimun_storage = Just $ Types.ByNodeType {
Types.producer = 12582912
Expand Down
10 changes: 7 additions & 3 deletions bench/cardano-profile/src/Cardano/Benchmarking/Profile/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ data Profile = Profile
, tracer :: Tracer
, cluster :: Cluster
, analysis :: Analysis
-- TODO
-- , overlay :: Aeson.Object
, derived :: Derived
, cli_args :: CliArgs
-- TODO
, overlay :: Aeson.Object
}
deriving (Eq, Show, Generic)

Expand Down Expand Up @@ -399,16 +399,18 @@ data ClusterNomad = ClusterNomad
{ namespace :: String
, nomad_class :: String
, resources :: ByNodeType Resources
, host_volumes :: Maybe [Aeson.Object]
, fetch_logs_ssh :: Bool
}
deriving (Eq, Show, Generic)

instance Aeson.ToJSON ClusterNomad where
toJSON p@(ClusterNomad _ _ _ _) =
toJSON p@(ClusterNomad _ _ _ _ _) =
Aeson.object
[ "namespace" Aeson..= namespace p
, "class" Aeson..= nomad_class p
, "resources" Aeson..= resources p
, "host_volumes" Aeson..= host_volumes p
, "fetch_logs_ssh" Aeson..= fetch_logs_ssh p
]

Expand All @@ -419,10 +421,12 @@ instance Aeson.FromJSON ClusterNomad where
<$> o Aeson..: "namespace"
<*> o Aeson..: "class"
<*> o Aeson..: "resources"
<*> o Aeson..: "host_volumes"
<*> o Aeson..: "fetch_logs_ssh"

data ClusterAWS = ClusterAWS
{ instance_type :: ByNodeType String
, use_public_routing :: Bool
}
deriving (Eq, Show, Generic)

Expand Down
3 changes: 3 additions & 0 deletions bench/cardano-profile/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,15 @@ ciTestBage = Types.Profile {
Types.producer = Types.Resources 2 15000 16000
, Types.explorer = Just $ Types.Resources 2 15000 16000
}
, Types.host_volumes = Nothing
, Types.fetch_logs_ssh = False
}
, Types.aws = Types.ClusterAWS {
Types.instance_type = Types.ByNodeType {
Types.producer = "c5.2xlarge"
, Types.explorer = Just "m5.4xlarge"
}
, Types.use_public_routing = False
}
, Types.minimun_storage = Just $ Types.ByNodeType {
Types.producer = 12582912
Expand Down Expand Up @@ -244,6 +246,7 @@ ciTestBage = Types.Profile {
, Aeson.String "initialPoolCoin", Aeson.String "1000000000000000"
]
}
, Types.overlay = mempty
}

profilesMap :: Tasty.TestTree
Expand Down

0 comments on commit 18ead58

Please sign in to comment.