rapids/tests/scripts/run_tests.sh

78 lines
1.6 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() {
if [ $TYPE == 'frequency' ]
then
CONFIG_FILE="./tests/settings/frequency_config.yaml"
else
CONFIG_FILE="./tests/settings/periodic_config.yaml"
fi
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 "Copying participant files"
cp -r tests/data/external/participant_files/* data/external/participant_files/
2020-06-25 22:32:45 +02:00
2021-03-14 06:09:08 +01:00
echo "Running RAPIDS"
snakemake --configfile=$(echo $CONFIG_FILE) -R pull_phone_data -j12
2020-09-24 23:19:52 +02:00
}
display_usage() {
2021-03-14 06:09:08 +01:00
echo "Usage: run_test.sh [-t|--type] [periodic | frequency] [-a|--action] [ all | run | test]"
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
if [ $ACTION != 'test' ] && [ $ACTION != 'run' ] && [ $ACTION != 'both' ]
then
display_usage
fi
2021-03-14 06:09:08 +01: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
else
if [ $TYPE != 'frequency' ] && [ $TYPE != 'periodic' ]
2020-09-24 23:19:52 +02:00
then
display_usage
fi
2021-03-14 06:09:08 +01: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
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