diff --git a/scripts/run_Processor.sh b/scripts/run_Processor.sh index 00366a535de3b6f6bcf3458f4ec0b6c6ba761c73..763daaf657755590ede46bbca514cf479938b9ad 100755 --- a/scripts/run_Processor.sh +++ b/scripts/run_Processor.sh @@ -1,5 +1,44 @@ #!/bin/bash +SHORT=p:h +OPTS=$(getopt -a --options $SHORT -- "$@") +echo $OPTS +eval set -- "$OPTS" + +while : +do + case "$1" in + -p ) + component="$2" + shift 2 + ;; + -h | --help) + "Runs the appropriate Processor component using the -p flag, all other args are passed through" + exit 2 + ;; + --) + shift; + break + ;; + *) + echo "Unexpected option: $1" + ;; + esac +done + +printf "component is %s" "$component" + +if [ "$component" = "Environment" ]; then + echo "running env" + processor_class="ProcessorEnvironment.py" +elif [ "$component" = "Deposition" ];then + echo "running depo" + processor_class="ProcessorDeposition.py" +else + printf "component '%s' not recognised" "$component" +fi + + # directory containing all environment envs=/storage/app/EWS_prod/envs @@ -31,7 +70,9 @@ source /storage/app/miniconda3/bin/activate ${conda_env} proc_path="$( dirname "$(readlink -f "$0" )" )" # run the processor with all arguments -python ${proc_path}/../coordinator/Processor.py "$@" +processor=${proc_path}/../coordinator/${processor_class} +printf "processor is %s\n\n" "$processor" +python "${processor}" "$@" exit_code=$?; # deactivate conda environment