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

move ENV var export from buildkite script, to buildkite pipeline settings #190

Merged
merged 1 commit into from
Apr 29, 2019
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
13 changes: 2 additions & 11 deletions .buildkite/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,11 @@

set -euo pipefail

netname="${1-}"

if [ -z "$netname" ]; then
echo "usage: benchmark.sh NETWORK"
exit 1
fi

echo "--- Build code and benchmarks"
stack build --bench --no-run-benchmarks

export NETWORK=$netname

echo "+++ Run benchmarks"
stack bench cardano-wallet:restore --interleaved-output --ba "$netname +RTS -N2 -qg -A1m -I0 -T -M8G -h -RTS"
echo "+++ Run benchmarks - $NETWORK"
stack bench cardano-wallet:restore --interleaved-output --ba "$NETWORK +RTS -N2 -qg -A1m -I0 -T -M8G -h -RTS"

hp2pretty restore.hp

Expand Down
8 changes: 6 additions & 2 deletions .buildkite/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ env:
NIX_PATH: "channel:nixos-19.03"
steps:
- label: 'Restore benchmark - testnet'
command: "./.buildkite/benchmark.sh testnet"
command: "./.buildkite/benchmark.sh"
timeout_in_minutes: 60
agents:
system: x86_64-linux
env:
NETWORK: testnet
- label: 'Restore benchmark - mainnet'
command: "./.buildkite/benchmark.sh mainnet"
command: "./.buildkite/benchmark.sh"
timeout_in_minutes: 60
agents:
system: x86_64-linux
env:
NETWORK: mainnet
14 changes: 14 additions & 0 deletions test/bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import Fmt
( fmt, (+|), (+||), (|+), (||+) )
import Say
( sayErr )
import System.Environment
( getArgs, setEnv )
import System.IO
( BufferMode (..), hSetBuffering, stderr, stdout )

Expand All @@ -77,6 +79,7 @@ main = do
hSetBuffering stdout NoBuffering
hSetBuffering stderr NoBuffering
installSignalHandlers
getArgs >>= overrideEnvironment
prepareNode
runBenchmarks
[ bench ("restore " <> toText network <> " seq")
Expand Down Expand Up @@ -125,6 +128,17 @@ bench benchName action = do
printResult :: Text -> Double -> IO ()
printResult benchName dur = sayErr . fmt $ " "+|benchName|+": "+|secs dur|+""

-- FIXME This only exists because somehow, in buildkite, we can't pass ENV var
-- to the haskell executable? There's probably some Nix magic going on and I
-- don't have time for this.
overrideEnvironment :: [String] -> IO ()
overrideEnvironment [ntwrk] =
setEnv "NETWORK" ntwrk
overrideEnvironment [] =
return ()
overrideEnvironment _ =
fail "benchmark expects only one argument to override the '$NETWORK' ENV var"

{-------------------------------------------------------------------------------
Benchmarks
-------------------------------------------------------------------------------}
Expand Down