Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 1513ceb

Browse files
committed
Merge branch 'master' of github.com:startupturbo/nancy into docker_cp
2 parents 801d619 + 76fa9be commit 1513ceb

File tree

3 files changed

+74
-74
lines changed

3 files changed

+74
-74
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ Currently Nancy works only with PostgreSQL versions 9.6 and 10.
1717

1818
Requirements
1919
===
20-
Linux or MacOS machine with installed Docker. To use Nancy CLI on AWS EC2
21-
instances, you also need Docker Machine (https://docs.docker.com/machine/).
20+
To use Nancy CLI you need Linux or MacOS with installed Docker. If you plan
21+
to run experiments in AWS EC2 instances, you also need Docker Machine
22+
(https://docs.docker.com/machine/).
2223

2324
Installation
2425
===
@@ -30,7 +31,7 @@ source ~/.bashrc
3031

3132
Getting started
3233
===
33-
To these commands:
34+
Start with these commands:
3435
```bash
3536
nancy help
3637
nancy run help

nancy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ case "$1" in
3333
if [ ! -f "${BASH_SOURCE%/*}/nancy_$1.sh" ]
3434
then
3535
>&2 echo "ERROR: Unknown command."
36+
>&2 echo "Try 'nancy help'"
3637
exit 1;
3738
fi
3839
cmd="${BASH_SOURCE%/*}/nancy_$1.sh"

nancy_run.sh

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ while true; do
2626
way, two runs are needed. If one needs to only collect query plans for each
2727
query group, a single run is enough. And finally, if there is a goal to find
2828
an optimal value for some PostgreSQL setting, multiple runs will be needed to
29-
check how various values of specified setting affect performance of specified
30-
database and workload.
29+
check how various values of the specified setting affect performance of the
30+
specified database and workload.
3131
3232
4 main parts of each run are:
3333
- environment: where it will happen, PostgreSQL version, etc;
@@ -154,7 +154,7 @@ while true; do
154154
155155
\033[1m--aws-keypair-name\033[22m (string)
156156
157-
THe name of key pair used on EC2 instance to allow accessing to it. Must
157+
The name of key pair used on EC2 instance to allow accessing to it. Must
158158
correspond to the value of the '--aws-ssh-key-path' option.
159159
160160
The option may be used only with '--run-on aws'.
@@ -392,85 +392,83 @@ function checkParams() {
392392
([ -z ${TARGET_DDL_UNDO+x} ] && [ ! -z ${TARGET_DDL_DO+x} ]) \
393393
|| ([ -z ${TARGET_DDL_DO+x} ] && [ ! -z ${TARGET_DDL_UNDO+x} ])
394394
); then
395-
>&2 echo "ERROR: DDL code must have do and undo part."
396-
exit 1;
397-
fi
398-
399-
if [ -z ${ARTIFACTS_DESTINATION+x} ]; then
400-
>&2 echo "WARNING: Artifacts destination not given. Will use ./"
401-
ARTIFACTS_DESTINATION="."
402-
fi
395+
>&2 echo "ERROR: DDL code must have do and undo part."
396+
exit 1;
397+
fi
403398

404-
if [ -z ${ARTIFACTS_FILENAME+x} ]
405-
then
406-
>&2 echo "WARNING: Artifacts naming not set. Will use: $DOCKER_MACHINE"
407-
ARTIFACTS_FILENAME=$DOCKER_MACHINE
408-
fi
399+
if [ -z ${ARTIFACTS_DESTINATION+x} ]; then
400+
>&2 echo "WARNING: Artifacts destination not given. Will use ./"
401+
ARTIFACTS_DESTINATION="."
402+
fi
409403

410-
[ ! -z ${WORKLOAD_FULL_PATH+x} ] && ! checkPath WORKLOAD_FULL_PATH \
411-
&& >&2 echo "ERROR: workload file $WORKLOAD_FULL_PATH not found" \
412-
&& exit 1
404+
if [ -z ${ARTIFACTS_FILENAME+x} ]
405+
then
406+
>&2 echo "WARNING: Artifacts naming not set. Will use: $DOCKER_MACHINE"
407+
ARTIFACTS_FILENAME=$DOCKER_MACHINE
408+
fi
413409

414-
echo "WORKLOAD_FULL_PATH: $WORKLOAD_FULL_PATH"
410+
[ ! -z ${WORKLOAD_FULL_PATH+x} ] && ! checkPath WORKLOAD_FULL_PATH \
411+
&& >&2 echo "ERROR: workload file $WORKLOAD_FULL_PATH not found" \
412+
&& exit 1
415413

416-
[ ! -z ${WORKLOAD_BASIS_PATH+x} ] && ! checkPath WORKLOAD_BASIS_PATH \
417-
&& >&2 echo "ERROR: workload file $WORKLOAD_BASIS_PATH not found" \
418-
&& exit 1
414+
[ ! -z ${WORKLOAD_BASIS_PATH+x} ] && ! checkPath WORKLOAD_BASIS_PATH \
415+
&& >&2 echo "ERROR: workload file $WORKLOAD_BASIS_PATH not found" \
416+
&& exit 1
419417

420-
if [ ! -z ${WORKLOAD_CUSTOM_SQL+x} ]; then
421-
checkPath WORKLOAD_CUSTOM_SQL
422-
if [ "$?" -ne "0" ]; then
423-
#>&2 echo "WARNING: Value given as workload-custom-sql: '$WORKLOAD_CUSTOM_SQL' not found as file will use as content"
424-
echo "$WORKLOAD_CUSTOM_SQL" > $TMP_PATH/workload_custom_sql_tmp.sql
425-
WORKLOAD_CUSTOM_SQL="$TMP_PATH/workload_custom_sql_tmp.sql"
426-
else
427-
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as workload-custom-sql will use as filename"
418+
if [ ! -z ${WORKLOAD_CUSTOM_SQL+x} ]; then
419+
checkPath WORKLOAD_CUSTOM_SQL
420+
if [ "$?" -ne "0" ]; then
421+
#>&2 echo "WARNING: Value given as workload-custom-sql: '$WORKLOAD_CUSTOM_SQL' not found as file will use as content"
422+
echo "$WORKLOAD_CUSTOM_SQL" > $TMP_PATH/workload_custom_sql_tmp.sql
423+
WORKLOAD_CUSTOM_SQL="$TMP_PATH/workload_custom_sql_tmp.sql"
424+
else
425+
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as workload-custom-sql will use as filename"
426+
fi
428427
fi
429-
fi
430428

431-
if [ ! -z ${AFTER_DB_INIT_CODE+x} ]; then
432-
checkPath AFTER_DB_INIT_CODE
433-
if [ "$?" -ne "0" ]; then
434-
#>&2 echo "WARNING: Value given as after_db_init_code: '$AFTER_DB_INIT_CODE' not found as file will use as content"
435-
echo "$AFTER_DB_INIT_CODE" > $TMP_PATH/after_db_init_code_tmp.sql
436-
AFTER_DB_INIT_CODE="$TMP_PATH/after_db_init_code_tmp.sql"
437-
else
438-
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as after_db_init_code will use as filename"
429+
if [ ! -z ${AFTER_DB_INIT_CODE+x} ]; then
430+
checkPath AFTER_DB_INIT_CODE
431+
if [ "$?" -ne "0" ]; then
432+
#>&2 echo "WARNING: Value given as after_db_init_code: '$AFTER_DB_INIT_CODE' not found as file will use as content"
433+
echo "$AFTER_DB_INIT_CODE" > $TMP_PATH/after_db_init_code_tmp.sql
434+
AFTER_DB_INIT_CODE="$TMP_PATH/after_db_init_code_tmp.sql"
435+
else
436+
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as after_db_init_code will use as filename"
437+
fi
439438
fi
440-
fi
441439

442-
if [ ! -z ${TARGET_DDL_DO+x} ]; then
443-
checkPath TARGET_DDL_DO
444-
if [ "$?" -ne "0" ]; then
445-
#>&2 echo "WARNING: Value given as target_ddl_do: '$TARGET_DDL_DO' not found as file will use as content"
446-
echo "$TARGET_DDL_DO" > $TMP_PATH/target_ddl_do_tmp.sql
447-
TARGET_DDL_DO="$TMP_PATH/target_ddl_do_tmp.sql"
448-
else
449-
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as target_ddl_do will use as filename"
440+
if [ ! -z ${TARGET_DDL_DO+x} ]; then
441+
checkPath TARGET_DDL_DO
442+
if [ "$?" -ne "0" ]; then
443+
#>&2 echo "WARNING: Value given as target_ddl_do: '$TARGET_DDL_DO' not found as file will use as content"
444+
echo "$TARGET_DDL_DO" > $TMP_PATH/target_ddl_do_tmp.sql
445+
TARGET_DDL_DO="$TMP_PATH/target_ddl_do_tmp.sql"
446+
else
447+
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as target_ddl_do will use as filename"
448+
fi
450449
fi
451-
fi
452450

453-
if [ ! -z ${TARGET_DDL_UNDO+x} ]; then
454-
checkPath TARGET_DDL_UNDO
455-
if [ "$?" -ne "0" ]; then
456-
#>&2 echo "WARNING: Value given as target_ddl_undo: '$TARGET_DDL_UNDO' not found as file will use as content"
457-
echo "$TARGET_DDL_UNDO" > $TMP_PATH/target_ddl_undo_tmp.sql
458-
TARGET_DDL_UNDO="$TMP_PATH/target_ddl_undo_tmp.sql"
459-
else
460-
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as target_ddl_undo will use as filename"
451+
if [ ! -z ${TARGET_DDL_UNDO+x} ]; then
452+
checkPath TARGET_DDL_UNDO
453+
if [ "$?" -ne "0" ]; then
454+
#>&2 echo "WARNING: Value given as target_ddl_undo: '$TARGET_DDL_UNDO' not found as file will use as content"
455+
echo "$TARGET_DDL_UNDO" > $TMP_PATH/target_ddl_undo_tmp.sql
456+
TARGET_DDL_UNDO="$TMP_PATH/target_ddl_undo_tmp.sql"
457+
else
458+
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as target_ddl_undo will use as filename"
459+
fi
461460
fi
462-
fi
463461

464-
if [ ! -z ${TARGET_CONFIG+x} ]; then
465-
checkPath TARGET_CONFIG
466-
if [ "$?" -ne "0" ]; then
467-
#>&2 echo "WARNING: Value given as target_config: '$TARGET_CONFIG' not found as file will use as content"
468-
echo "$TARGET_CONFIG" > $TMP_PATH/target_config_tmp.conf
469-
TARGET_CONFIG="$TMP_PATH/target_config_tmp.conf"
470-
else
471-
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as target_config will use as filename"
462+
if [ ! -z ${TARGET_CONFIG+x} ]; then
463+
checkPath TARGET_CONFIG
464+
if [ "$?" -ne "0" ]; then
465+
#>&2 echo "WARNING: Value given as target_config: '$TARGET_CONFIG' not found as file will use as content"
466+
echo "$TARGET_CONFIG" > $TMP_PATH/target_config_tmp.conf
467+
TARGET_CONFIG="$TMP_PATH/target_config_tmp.conf"
468+
else
469+
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as target_config will use as filename"
470+
fi
472471
fi
473-
fi
474472
}
475473

476474
checkParams;
@@ -631,7 +629,7 @@ function copyFile() {
631629
# TODO: option – hard links OR regular `cp`
632630
docker cp ${1/file:\/\//} $containerHash:$MACHINE_HOME/
633631
elif [ "$RUN_ON" = "aws" ]; then
634-
docker-machine scp $1 $DOCKER_MACHINE:/home/ubuntu
632+
docker-machine scp $1 $DOCKER_MACHINE:/home/ubuntu/nancy_${containerHash}
635633
else
636634
>&2 echo "ASSERT: must not reach this point"
637635
exit 1
@@ -734,8 +732,8 @@ else
734732
#cp "$TMP_PATH/nancy_$containerHash/"$ARTIFACTS_FILENAME.json $ARTIFACTS_DESTINATION/
735733
#cp "$TMP_PATH/nancy_$containerHash/"$ARTIFACTS_FILENAME.log.gz $ARTIFACTS_DESTINATION/
736734
elif [ "$RUN_ON" = "aws" ]; then
737-
docker-machine scp $DOCKER_MACHINE:/home/ubuntu/$ARTIFACTS_FILENAME.json $ARTIFACTS_DESTINATION/
738-
docker-machine scp $DOCKER_MACHINE:/home/ubuntu/$ARTIFACTS_FILENAME.log.gz $ARTIFACTS_DESTINATION/
735+
docker-machine scp $DOCKER_MACHINE:/home/ubuntu/nancy_$containerHash/$ARTIFACTS_FILENAME.json $ARTIFACTS_DESTINATION/
736+
docker-machine scp $DOCKER_MACHINE:/home/ubuntu/nancy_$containerHash/$ARTIFACTS_FILENAME.log.gz $ARTIFACTS_DESTINATION/
739737
else
740738
>&2 echo "ASSERT: must not reach this point"
741739
exit 1

0 commit comments

Comments
 (0)