rapids/tests/scripts/run_tests.sh

85 lines
1.9 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-08 22:14:10 +02:00
if [ "$TYPE" == 'frequency' ]
2021-03-14 06:09:08 +01:00
then
CONFIG_FILE="./tests/settings/frequency_config.yaml"
2021-04-08 22:14:10 +02:00
elif [ "$TYPE" == 'event' ]
then
CONFIG_FILE="./tests/settings/event_config.yaml"
2021-03-14 06:09:08 +01:00
else
CONFIG_FILE="./tests/settings/periodic_config.yaml"
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"
snakemake --configfile=$(echo $CONFIG_FILE) --delete-all-output -j1
2021-03-14 06:09:08 +01:00
echo "Running RAPIDS"
snakemake --configfile=$(echo $CONFIG_FILE) -R pull_phone_data -j1
2020-09-24 23:19:52 +02:00
}
display_usage() {
2021-04-08 22:14:10 +02:00
echo "Usage: run_test.sh [-t|--type] [periodic | frequency | event] [-a|--action] [ all | 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-03-14 06:09:08 +01:00
TYPE="frequency"
run_pipeline
python tests/scripts/run_tests.py frequency
TYPE="periodic"
run_pipeline
python tests/scripts/run_tests.py periodic
2021-04-08 22:14:10 +02:00
TYPE="event"
run_pipeline
python tests/scripts/run_tests.py event
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
if { [ "$TYPE" != 'frequency' ] && [ "$TYPE" != 'periodic' ] && [ "$TYPE" != '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-03-14 06:09:08 +01:00
python tests/scripts/run_tests.py $(echo $TYPE)
2020-09-24 23:19:52 +02:00
fi
fi