-
Notifications
You must be signed in to change notification settings - Fork 5
/
zbrains_batch
executable file
·36 lines (31 loc) · 1.1 KB
/
zbrains_batch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Change the current working directory to the parent directory
cd "$(dirname "$0")"
pyinit_flag=0
# Set a default value for env_path
default_env_path="/data/mica1/01_programs/miniforge3"
env_path=$default_env_path
# Create an array to hold the arguments for src.zbrains
args=()
for arg in "$@"
do
if [[ $arg == --pyinit=* ]]; then
env_path="${arg#*=}"
pyinit_flag=1
else
# If the argument is not --pyinit, add it to the args array
args+=("$arg")
fi
done
if [[ $env_path != "false" ]]; then
if [[ $pyinit_flag -eq 0 ]]; then
echo "The --pyinit argument was left empty, zbrains will use the MICA lab default Python environment, to disable this behaviour and use your current environment use the --pyinit=false argument."
fi
echo "Activating Python environment at $env_path"
source $env_path/bin/activate zbrains
echo "Activated zbrains environment"
else
echo "The --pyinit argument was set to false, zbrains will use your currently active Python environment."
fi
# Pass the args array to src.zbrains
python -m src.zbrains "${args[@]}"