Skip to content

Commit 5348faf

Browse files
committed
Modified install_rms.sh to Use The Correct Backend
Added developer install option for install_rms.sh
1 parent 8863298 commit 5348faf

File tree

2 files changed

+60
-10
lines changed

2 files changed

+60
-10
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file contains the script used by GitHub actions to execute the Continuous Integration (CI)
33
# for RMG-Py. This includes building RMG and its dependencies, executing the unit tests,
44
# functional tests, database tests, and regression tests.
5-
#
5+
#
66
# This will run automatically on any push to any branch, but will only run one instance of
77
# itself at a time per branch (to avoid spawning tons of runners, which prevents them from
88
# executing).
@@ -14,7 +14,7 @@
1414
#
1515
#
1616
# Changelog:
17-
# 2023-04 - Jackson Burns - Added this header, regression tests, cleanup of action in
17+
# 2023-04 - Jackson Burns - Added this header, regression tests, cleanup of action in
1818
# in general, and documentation throughout the file.
1919
# 2023-05 - added Docker build steps
2020
# 2023-05-12 - added changes to allow running on forks
@@ -54,6 +54,8 @@ env:
5454
RMG_DATABASE_BRANCH: main
5555
# RMS branch to use for ReactionMechanismSimulator installation
5656
RMS_BRANCH: for_rmg
57+
# Use standard RMS installation mode for install_rms.sh
58+
RMS_MODE: standard
5759
# julia parallel pre-compilation leads to race conditions and hangs, so we limit it to run in serial
5860
JULIA_NUM_PRECOMPILE_TASKS: 1
5961

@@ -131,7 +133,7 @@ jobs:
131133
name: Regression Test
132134
# skip scheduled runs from forks
133135
if: ${{ !( github.repository != 'ReactionMechanismGenerator/RMG-Py' && github.event_name == 'schedule' ) }}
134-
env:
136+
env:
135137
# This is true only if this is a reference case for the regression testing:
136138
REFERENCE_JOB: ${{ github.ref == 'refs/heads/main' && github.repository == 'ReactionMechanismGenerator/RMG-Py' }}
137139
defaults:
@@ -167,7 +169,7 @@ jobs:
167169
168170
# RMG build step
169171
- run: make install
170-
172+
171173
- name: Make separate No-RMS conda env
172174
run: |
173175
conda create --name rmg_env_without_rms --clone rmg_env
@@ -269,7 +271,7 @@ jobs:
269271
REFERENCE: stable_regression_results
270272
run: |
271273
conda activate rmg_env_without_rms
272-
274+
273275
exec 2> >(tee -a regression.stderr >&2) 1> >(tee -a regression.stdout)
274276
mkdir -p "test/regression-diff"
275277
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment minimal_surface;

install_rms.sh

100644100755
Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ echo "Current conda environment: $current_env"
4343

4444
# Set environment variables for the current environment, for future uses
4545
# https://juliapy.github.io/PythonCall.jl/stable/pythoncall/#If-you-already-have-Python-and-required-Python-packages-installed
46-
conda env config vars set JULIA_CONDAPKG_BACKEND=Null
46+
conda env config vars set JULIA_CONDAPKG_BACKEND=Current
47+
conda env config vars set JULIA_CONDAPKG_EXE=$(which conda)
4748
conda env config vars set JULIA_PYTHONCALL_EXE=$CONDA_PREFIX/bin/python
4849
conda env config vars set PYTHON_JULIAPKG_EXE=$(which julia)
4950
conda env config vars set PYTHON_JULIAPKG_PROJECT=$CONDA_PREFIX/julia_env
5051
# Also export for current shell/session (needed for Docker/non-interactive use)
51-
export JULIA_CONDAPKG_BACKEND=Null
52+
export JULIA_CONDAPKG_BACKEND=Current
53+
export JULIA_CONDAPKG_EXE="$(which conda)"
5254
export JULIA_PYTHONCALL_EXE="$CONDA_PREFIX/bin/python"
5355
export PYTHON_JULIAPKG_EXE="$(which julia)"
5456
export PYTHON_JULIAPKG_PROJECT="$CONDA_PREFIX/julia_env"
@@ -58,11 +60,57 @@ conda install -y conda-forge::pyjuliacall
5860
echo "Environment variables referencing JULIA:"
5961
env | grep JULIA
6062

61-
# Use RMS_BRANCH environment variable if set, otherwise default to for_rmg
63+
# Ask user whether to do a standard or developer install
64+
if [ -z "$RMS_MODE" ]; then
65+
echo "Choose installation mode:"
66+
echo " 1) Standard install (download from GitHub)"
67+
echo " 2) Developer install (install from local path)"
68+
read -p "Enter 1 or 2 [default: 1]: " installation_choice
69+
70+
if [ "$installation_choice" = "2" ]; then
71+
RMS_MODE="dev"
72+
else
73+
RMS_MODE="standard"
74+
fi
75+
fi
76+
77+
echo "Selected RMS installation mode: $RMS_MODE"
78+
79+
# Default RMS branch for standard install
6280
RMS_BRANCH=${RMS_BRANCH:-for_rmg}
63-
echo "Installing ReactionMechanismSimulator from branch: $RMS_BRANCH"
6481

65-
julia -e "using Pkg; Pkg.add(Pkg.PackageSpec(name=\"ReactionMechanismSimulator\", url=\"https://github.com/ReactionMechanismGenerator/ReactionMechanismSimulator.jl.git\", rev=\"$RMS_BRANCH\")); using ReactionMechanismSimulator; Pkg.instantiate()" || echo "RMS install error - continuing anyway ¯\_(ツ)_/¯"
82+
# Ask for local RMS path
83+
if [ "$RMS_MODE" = "dev" ]; then
84+
read -e -p "Please enter full path to your local RMS source code: " RMS_PATH
85+
if [ ! -d "$RMS_PATH" ]; then
86+
echo "ERROR: '$RMS_PATH' is not a valid directory."
87+
exit 1
88+
fi
89+
echo "Using local RMS path: $RMS_PATH"
90+
fi
91+
92+
if [ "$RMS_MODE" = "standard" ]; then
93+
echo "Installing RMS from branch: $RMS_BRANCH"
94+
julia << EOF || echo "RMS standard install error - continuing anyway ¯\\_(ツ)_/¯"
95+
using Pkg
96+
Pkg.activate(ENV["PYTHON_JULIAPKG_PROJECT"])
97+
Pkg.add(Pkg.PackageSpec(name="ReactionMechanismSimulator", url="https://github.com/ReactionMechanismGenerator/ReactionMechanismSimulator.jl.git", rev="$RMS_BRANCH"))
98+
Pkg.instantiate()
99+
using ReactionMechanismSimulator
100+
EOF
101+
elif [ "$RMS_MODE" = "dev" ]; then
102+
echo "Installing RMS in developer mode from path: $RMS_PATH"
103+
julia << EOF || echo "RMS developer install error - continuing anyway ¯\\_(ツ)_/¯"
104+
using Pkg
105+
Pkg.activate(ENV["PYTHON_JULIAPKG_PROJECT"])
106+
Pkg.develop(path="$RMS_PATH")
107+
Pkg.instantiate()
108+
using ReactionMechanismSimulator
109+
EOF
110+
else
111+
echo "Unknown RMS_MODE: $RMS_MODE. Must be either 'standard' or 'dev'."
112+
exit 1
113+
fi
66114

67115
echo "Checking if ReactionMechanismSimulator is installed in the current conda environment for Python usage..."
68116
python -c "from juliacall import Main; import sys; sys.exit(0 if Main.seval('Base.identify_package(\"ReactionMechanismSimulator\") !== nothing') and print('ReactionMechanismSimulator is installed in $current_env') is None else 1)"

0 commit comments

Comments
 (0)