From 3367e1335e4cd09969a47cb511a7b4122ef118ea Mon Sep 17 00:00:00 2001 From: jangorecki Date: Mon, 18 Mar 2019 18:56:09 +0530 Subject: [PATCH] clickhouse helpers --- clickhouse-active.sh | 4 ++++ run.sh | 6 +++++- versions.sh | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 clickhouse-active.sh diff --git a/clickhouse-active.sh b/clickhouse-active.sh new file mode 100755 index 00000000..2419a508 --- /dev/null +++ b/clickhouse-active.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +bash -c 'clickhouse-client --query="SELECT 0;"; exit $?' > /dev/null 2>&1 diff --git a/run.sh b/run.sh index 470f2b36..3ea4277f 100755 --- a/run.sh +++ b/run.sh @@ -10,6 +10,10 @@ export BATCH=$(date +%s) # confirm stop flag disabled if [[ -f ./stop ]]; then echo "# Benchmark run $BATCH aborted. 'stop' file exists, should be removed before calling 'run.sh'" && exit; fi; +# confirm clickhouse is not running +if [[ ./clickhouse-active.sh ]]; then echo "# Benchmark run $BATCH aborted. clickhouse-server is running, shut it down before calling 'run.sh'" && exit; fi; + + # set lock if [[ -f ./run.lock ]]; then echo "# Benchmark run $BATCH aborted. 'run.lock' file exists, this should be checked before calling 'run.sh'. Ouput redirection mismatch might have happened if writing output to same file as currently running $(cat ./run.lock) benchmark run" && exit; else echo $BATCH > run.lock; fi; @@ -30,7 +34,7 @@ if [[ "$DO_UPGRADE" == true && "$RUN_SOLUTIONS" =~ "pydatatable" ]]; then ./pyda if [[ "$DO_UPGRADE" == true && "$RUN_SOLUTIONS" =~ "spark" ]]; then ./spark/init-spark.sh; fi; #if [[ "$DO_UPGRADE" == true && "$RUN_SOLUTIONS" =~ "clickhouse" ]]; then ./clickhouse/init-clickhouse.sh; fi; # for now manual as requires sudo -# produce VERSION, REVISION files for each solution, this will crash if clickhouse server not started +# produce VERSION, REVISION files for each solution ./versions.sh # run diff --git a/versions.sh b/versions.sh index 4399e10c..59ba3119 100755 --- a/versions.sh +++ b/versions.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e -# this will crash if clickhouse server not started -clickhouse-client --query="SELECT version()" > clickhouse/VERSION && echo "" > clickhouse/REVISION +# we assume client was installed/upgraded together with server +clickhouse-client --version-clean > clickhouse/VERSION && echo "" > clickhouse/REVISION Rscript -e 'v=read.dcf(system.file(package="data.table", "DESCRIPTION"), fields=c("Version","Revision")); invisible(mapply(function(f, v) writeLines(v, file.path("datatable", f)), toupper(colnames(v)), c(v)))' Rscript -e 'v=read.dcf(system.file(package="dplyr", "DESCRIPTION"), fields=c("Version","RemoteSha")); colnames(v)[colnames(v)=="RemoteSha"]="Revision"; invisible(mapply(function(f, v) writeLines(v, file.path("dplyr", f)), toupper(colnames(v)), c(v)))' @@ -14,7 +14,7 @@ python -c 'import dask as dk; open("dask/VERSION","w").write(dk.__version__); op source ./modin/py-modin/bin/activate python -c 'import modin as modin; open("modin/VERSION","w").write(modin.__version__); open("modin/REVISION","w").write("");' > /dev/null source ./pandas/py-pandas/bin/activate -python -c 'import pandas as pd; open("pandas/VERSION","w").write(pd.__version__); open("pandas/REVISION","w").write(pd.__git_version__);' > /dev/null 2>1& +python -c 'import pandas as pd; open("pandas/VERSION","w").write(pd.__version__); open("pandas/REVISION","w").write(pd.__git_version__);' > /dev/null 2>&1 source ./pydatatable/py-pydatatable/bin/activate python -c 'import datatable as dt; open("pydatatable/VERSION","w").write(dt.__version__); open("pydatatable/REVISION","w").write(dt.__git_revision__);' > /dev/null source ./spark/py-spark/bin/activate