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

Add {100,10,1}-wallet restore benchmarks #2243

Merged
merged 4 commits into from
Oct 19, 2020
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
17 changes: 9 additions & 8 deletions .buildkite/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ steps:
system: x86_64-linux
queue: benchmark

- label: 'Restore benchmark - cardano testnet'
command: "./.buildkite/bench-restore.sh testnet"
env:
HOME: "/cache/cardano-wallet.home"
timeout_in_minutes: 600
agents:
system: x86_64-linux
queue: benchmark
# Temporary disabled due to timing out (#2221)
# - label: 'Restore benchmark - cardano testnet'
# command: "./.buildkite/bench-restore.sh testnet"
# env:
# HOME: "/cache/cardano-wallet.home"
# timeout_in_minutes: 600
# agents:
# system: x86_64-linux
# queue: benchmark

- label: 'Database benchmark'
command: "./.buildkite/bench-db.sh"
Expand Down
32 changes: 26 additions & 6 deletions lib/core-integration/src/Cardano/Wallet/BenchShared.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Cardano.BM.Data.Severity
import Cardano.BM.Setup
( setupTrace_ )
import Cardano.BM.Trace
( Trace )
( Trace, nullTracer )
import Cardano.Launcher.Node
( CardanoNodeConfig (..)
, CardanoNodeConn (..)
Expand All @@ -60,6 +60,8 @@ import Data.Aeson
( ToJSON (..) )
import Data.Functor
( (<&>) )
import Data.Maybe
( fromMaybe )
import Data.Text
( Text )
import Fmt
Expand All @@ -81,6 +83,7 @@ import Options.Applicative
, showDefaultWith
, strArgument
, strOption
, switch
, value
)
import Say
Expand Down Expand Up @@ -115,12 +118,17 @@ execBenchWithNode networkConfig action = do
hSetBuffering stdout NoBuffering
hSetBuffering stderr NoBuffering

(_logCfg, tr) <- initBenchmarkLogging Info
(_logCfg, tr') <- initBenchmarkLogging Info
let tr = if argQuiet args then nullTracer else tr'
installSignalHandlers (return ())

void $ withNetworkConfiguration args $ \nodeConfig ->
withCardanoNode (trMessageText tr) nodeConfig $ \cp ->
action tr (networkConfig args) (nodeSocketFile cp)
case argUseAlreadyRunningNodeSocketPath args of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Just socket ->
action tr (networkConfig args) socket
Nothing -> do
void $ withNetworkConfiguration args $ \nodeConfig ->
withCardanoNode (trMessageText tr) nodeConfig $ \cp ->
action tr (networkConfig args) (nodeSocketFile cp)

withNetworkConfiguration :: RestoreBenchArgs -> (CardanoNodeConfig -> IO a) -> IO a
withNetworkConfiguration args action = do
Expand All @@ -136,7 +144,7 @@ withNetworkConfiguration args action = do
withNodeDir $ \dir -> action CardanoNodeConfig
{ nodeDir = dir
, nodeConfigFile = networkDir </> "configuration.json"
, nodeDatabaseDir = "db"
, nodeDatabaseDir = fromMaybe "db" (argNodeDatabaseDir args)
, nodeDlgCertFile = Nothing
, nodeSignKeyFile = Nothing
, nodeTopologyFile = networkDir </> "topology.json"
Expand All @@ -158,6 +166,8 @@ data RestoreBenchArgs = RestoreBenchArgs
{ argNetworkName :: String
, argConfigsDir :: FilePath
, argNodeDatabaseDir :: Maybe FilePath
, argUseAlreadyRunningNodeSocketPath :: Maybe FilePath
, argQuiet :: Bool
} deriving (Show, Eq)

restoreBenchArgsParser
Expand All @@ -184,6 +194,16 @@ restoreBenchArgsParser envNetwork envConfigsDir envNodeDatabaseDir = RestoreBenc
<> envDefault "NODE_DB" envNodeDatabaseDir
<> help "Directory to put cardano-node state. Defaults to $NODE_DB, \
\falls back to temporary directory"))
<*> optional (strOption
( long "running-node"
<> metavar "SOCKET"
<> envDefault "CARDANO_NODE_SOCKET" envNodeDatabaseDir
<> help "Path to the socket of an already running cardano-node. \
\Also set by $CARDANO_NODE_SOCKET. If not set, cardano-node \
\will automatically be started."))
<*> switch
( long ("quiet")
<> help "Reduce unnecessary log output.")
where
envDefault :: HasValue f => String -> Maybe a -> Mod f a
envDefault name env = showDefaultWith (const ('$':name))
Expand Down
Loading