forked from ILLIXR/ILLIXR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.sh
executable file
·56 lines (42 loc) · 1.46 KB
/
runner.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#--- Script defining values to be used by accompanying install scripts ---#
### Setup ###
## Update the working directory
cd "$(dirname ${0})"
## Source the default values for imported variables
. scripts/default_values.sh
## Source the global helper functions
. scripts/system_utils.sh
## Source the configurations for our dependencies
. deps.sh
## Setup script
interp_cmd="python"
interp_args=""
script_path="runner/runner/main.py"
script_args="${@}"
venv_name="illixr-runner"
### Launch application
## If we find an installation log for conda, use the src_dir recorded
detect_dependency "${dep_name_conda}" "${deps_log_dir}"
if [ "$?" -eq 0 ]; then
src_dir_conda="${src_dir}"
dep_log_path_conda="${dep_log_path}"
else
src_dir_conda="${parent_dir_conda}/${dep_name_conda}"
dep_log_path_conda="${dep_log_path}"
print_warning "Installation log for conda not found at '${dep_log_path_conda}'."
echo "Checking in '${src_dir_conda}'."
fi
## Source the conda environment profile
. "${src_dir_conda}/etc/profile.d/conda.sh"
## Setup virtual environment
check_cmd_conda=$(conda --version 2>/dev/null)
if [ "$?" -eq 0 ]; then
## Conda found => Reset and activate the virtual environment
conda deactivate
conda activate "${venv_name}"
else
print_warning "Conda not found. Attempting to run ILLIXR via '${interp_cmd}' anyway ..."
fi
## Start executing action from main
"${interp_cmd}" ${interp_args} "${script_path}" "${script_args}"