rapids/tests/scripts/run_tests.sh

103 lines
2.8 KiB
Bash
Raw Normal View History

2020-06-05 18:46:36 +02:00
#!/bin/bash
2021-03-14 06:09:08 +01:00
run_pipeline() {
2021-04-15 02:52:45 +02:00
if [ "$TYPE" == 'stz_frequency' ]
2021-03-14 06:09:08 +01:00
then
2021-04-15 02:52:45 +02:00
CONFIG_FILE="./tests/settings/stz_frequency_config.yaml"
elif [ "$TYPE" == 'mtz_frequency' ]
then
CONFIG_FILE="./tests/settings/mtz_frequency_config.yaml"
elif [ "$TYPE" == 'stz_event' ]
then
2021-04-15 02:52:45 +02:00
CONFIG_FILE="./tests/settings/stz_event_config.yaml"
elif [ "$TYPE" == 'mtz_event' ]
then
CONFIG_FILE="./tests/settings/mtz_event_config.yaml"
elif [ "$TYPE" == 'stz_periodic' ]
then
CONFIG_FILE="./tests/settings/stz_periodic_config.yaml"
2021-03-14 06:09:08 +01:00
else
2021-04-15 02:52:45 +02:00
CONFIG_FILE="./tests/settings/mtz_periodic_config.yaml"
2021-03-14 06:09:08 +01:00
fi
echo "Copying participant files"
2021-04-08 22:14:10 +02:00
mkdir -p data/external/participant_files/
cp -r tests/data/external/participant_files/* data/external/participant_files/
2021-03-14 06:09:08 +01:00
echo $TYPE
echo "Deleting old outputs"
2021-04-20 18:02:21 +02:00
snakemake --configfile=$(echo $CONFIG_FILE) --delete-all-output -j1 || exit
2021-03-14 06:09:08 +01:00
echo "Running RAPIDS"
2021-04-20 18:02:21 +02:00
snakemake --configfile=$(echo $CONFIG_FILE) -R pull_phone_data -j2 || exit
2020-09-24 23:19:52 +02:00
}
display_usage() {
2021-04-15 02:52:45 +02:00
echo "Usage: run_test.sh [-t|--type] [all | stz_periodic | mtz_periodic | stz_frequency | mtz_frequency | stz_event | mtz_event] [-a|--action] [test | run | both]"
2021-03-14 06:09:08 +01:00
exit 1
2020-09-24 23:19:52 +02:00
}
2021-03-14 06:09:08 +01:00
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-t|--type)
TYPE="$2"
shift # past argument
shift # past value
;;
-a|--action)
ACTION="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
2021-04-08 22:14:10 +02:00
if { [ "$TYPE" == 'all' ]; }
2020-09-24 23:19:52 +02:00
then
2021-04-15 02:52:45 +02:00
TYPE="stz_frequency"
run_pipeline
2021-04-20 23:28:06 +02:00
python tests/scripts/run_tests.py stz_frequency || exit
2021-04-15 02:52:45 +02:00
TYPE="mtz_frequency"
run_pipeline
2021-04-20 23:28:06 +02:00
python tests/scripts/run_tests.py mtz_frequency || exit
2021-04-15 02:52:45 +02:00
TYPE="stz_periodic"
run_pipeline
2021-04-20 23:28:06 +02:00
python tests/scripts/run_tests.py stz_periodic || exit
2021-04-15 02:52:45 +02:00
TYPE="mtz_periodic"
2021-03-14 06:09:08 +01:00
run_pipeline
2021-04-20 23:28:06 +02:00
python tests/scripts/run_tests.py mtz_periodic || exit
2021-04-15 02:52:45 +02:00
TYPE="stz_event"
2021-03-14 06:09:08 +01:00
run_pipeline
2021-04-20 23:28:06 +02:00
python tests/scripts/run_tests.py stz_event || exit
2021-04-15 02:52:45 +02:00
TYPE="mtz_event"
2021-04-08 22:14:10 +02:00
run_pipeline
2021-04-20 23:28:06 +02:00
python tests/scripts/run_tests.py mtz_event || exit
2021-03-14 06:09:08 +01:00
else
2021-04-08 22:14:10 +02:00
if { [ "$ACTION" != 'test' ] && [ "$ACTION" != 'run' ] && [ "$ACTION" != 'both' ]; }
then
display_usage
fi
2021-04-15 02:52:45 +02:00
if { [ "$TYPE" != 'stz_frequency' ] && [ "$TYPE" != 'mtz_frequency' ] && [ "$TYPE" != 'stz_periodic' ] && [ "$TYPE" != 'mtz_periodic' ] && [ "$TYPE" != 'stz_event' ] && [ "$TYPE" != 'mtz_event' ]; }
2020-09-24 23:19:52 +02:00
then
display_usage
fi
2021-03-14 06:09:08 +01:00
2021-04-08 22:14:10 +02:00
if { [ "$ACTION" == 'run' ] || [ "$ACTION" == 'both' ]; }
2020-09-24 23:19:52 +02:00
then
2021-03-14 06:09:08 +01:00
run_pipeline
fi
2021-04-08 22:14:10 +02:00
if { [ "$ACTION" == 'test' ] || [ "$ACTION" == 'both' ]; }
2020-09-24 23:19:52 +02:00
then
2021-04-20 18:02:21 +02:00
python tests/scripts/run_tests.py $(echo $TYPE) || exit
2020-09-24 23:19:52 +02:00
fi
fi