Skip to content

Commit db49ab4

Browse files
authored
fix: Clearly delineate between editable/non-editable MC installs (#114)
This captures a handful of the higher priority elements introduced by #91, while focusing on backwards compatibility. The primary modification here is to make more clear the distinction between cloned/uncloned editable/non-editable installs and have the docs adequately reflect the actions in the `install.sh` script. Previously, the documentation stated that the installer would clone our default model components, which was true before we transitioned to the package model. As we've made that transition, some of the implied functionality has been lost—right now, running the install script with no arguments will clone MCs but not install them... so still technically accurate, but somewhat misleading because we do not mention that any further actions to be taken. In a similar way, calling the script with `--no-clone` will also not clone MCs, but will also not install them even though one could argue that a familiar user (e.g., me) might expect `--no-clone` to not _clone_ the MC repos, but still install them using pip. There are a few other similar logic cases, but I won't discuss them at length. Instead, I'll summarize the behavior of the script as would be defined by this MR: | CLI Option | (clone) | `--no-clone` | |------------------|---------|---------------| | (production) | pip install model components from cloned versions | pip install model components from PyPI | | `--development` | pip install model components from cloned versions in editable mode | pip install model components from PyPI (same as above) | In all cases, when using this script, FIREWHEEL will be installed from this local version not PyPI. I don't think that's actually the case right now (looking at the line in the `install_firewheel` function), but this seems like it would be the expected behavior of running this script. Presumably, whoever's running the install script in the repo is doing it because they want to install that version of FIREWHEEL, not just have it turn around and download whatever the latest version is on PyPI.
1 parent 08a3acc commit db49ab4

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

docs/source/install/install.rst

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Once the configuration options have been set, run ``install.sh``:
192192
chmod +x install.sh
193193
./install.sh
194194
195-
This script will create necessary directories, installs and configures FIREWHEEL, and clone our default model component repositories.
195+
This script will create necessary directories, install and configure FIREWHEEL, and install our default model component repositories.
196196
The script will optionally install additional FIREWHEEL development dependencies by using either the ``-d`` or ``--development`` flag::
197197

198198
./install.sh -d
@@ -207,10 +207,24 @@ Once the entire cluster has been provisioned, we recommend running the :ref:`com
207207

208208
Installing Model Component Repositories
209209
---------------------------------------
210-
Before running any experiments, you will likely need to clone several Model Component repositories and install them.
211-
For example, you will likely want to install our ``base`` and ``linux`` repository.
212-
We recommend putting all Model Component repositories in ``/opt/firewheel/model_components``.
213-
Then you can *install* this location so that FIREWHEEL can leverage those model components::
210+
Before running any experiments, you will likely need to install several Model Component repositories.
211+
Model Component repositories provide extra features and customizations that give FIREWHEEL experiments their flexibility and modularity.
212+
213+
There are two ways to install Model Components.
214+
The first and easiest way is to use a premade Model Component repository which has been converted into a (pip-installable) Python package.
215+
Several of the most commonly used FIREWHEEL Model Components exist in this format, for example the ``base`` and ``linux`` Model Components.
216+
217+
.. code-block:: bash
218+
219+
pip install firewheel_repo_base
220+
221+
A selection of these MCs are installed by the ``install.sh`` script.
222+
223+
The second way to install a Model Component is using FIREWHEEL's helpers.
224+
This is a good solution for Model Component repositories that are either built or cloned to a local directory.
225+
We recommend putting all these Model Component repositories in ``/opt/firewheel/model_components``.
226+
Then you can use the :ref:`helper_repository_install` to add this location as a known FIREWHEEL Model Component repository::
227+
214228

215229
firewheel repository install /opt/firewheel/model_components
216230

install.sh

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# head node. Then your FIREWHEEL cluster will be ready to use!
1616
#
1717
# Requirements:
18-
# * Python >=3.7, with the path to its executable specified by PYTHON_BIN
18+
# * Python >=3.8, with the path to its executable specified by PYTHON_BIN
1919
# (we recommend using virtual environments).
2020
# * minimega and discovery installed and configured.
2121

@@ -223,47 +223,49 @@ function install_firewheel_generic() {
223223
# Arguments:
224224
# None
225225
# Globals:
226-
# FIREWHEEL_ROOT
226+
# FIREWHEEL_ROOT_DIR
227227
# PIP_ARGS
228228
# PYTHON_BIN
229229
#######################################
230230
function install_firewheel() {
231-
pushd "${FIREWHEEL_ROOT_DIR}"
232-
${PYTHON_BIN} -m pip install ${PIP_ARGS} firewheel
233-
if [ ! $? -eq 0 ];
234-
then
235-
install_firewheel_generic
236-
${PYTHON_BIN} -m pip install ${PIP_ARGS} --prefer-binary ./dist/firewheel-2.6.0.tar.gz
231+
local clone="$1"
232+
233+
if [[ $clone -eq 0 ]]; then
234+
${PYTHON_BIN} -m pip install ${PIP_ARGS} ${FIREWHEEL_ROOT_DIR}/[mcs]
235+
else
236+
${PYTHON_BIN} -m pip install ${PIP_ARGS} ${FIREWHEEL_ROOT_DIR}/
237+
${PYTHON_BIN} -m pip install ${PIP_ARGS} ${MC_DIR}/firewheel_repo_base
238+
${PYTHON_BIN} -m pip install ${PIP_ARGS} ${MC_DIR}/firewheel_repo_linux
239+
${PYTHON_BIN} -m pip install ${PIP_ARGS} ${MC_DIR}/firewheel_repo_vyos
237240
fi
238-
popd
239241
}
240242

241243
#######################################
242244
# Installing the FIREWHEEL package with development dependencies.
243245
# Arguments:
244246
# None
245247
# Globals:
246-
# FIREWHEEL_ROOT
248+
# FIREWHEEL_ROOT_DIR
247249
# PIP_ARGS
248250
# PYTHON_BIN
249251
#######################################
250252
function install_firewheel_development() {
251-
pushd "${FIREWHEEL_ROOT_DIR}"
253+
local clone="$1"
252254
install_firewheel_generic
253255

254256
# Install the development version.
255-
if [[ $1 -eq 1 ]]; then
256-
then
257+
if [[ $clone -eq 0 ]]; then
258+
${PYTHON_BIN} -m pip install ${PIP_ARGS} -e ${FIREWHEEL_ROOT_DIR}/[dev]
259+
else
257260
# In this case, we do not use the "dev" optional dependencies as
258261
# the user is using the source code version of these model components, rather
259262
# than the Python package installed repositories.
260263
${PYTHON_BIN} -m pip install ${PIP_ARGS} pre-commit tox
261-
${PYTHON_BIN} -m pip install ${PIP_ARGS} -e .[format,docs]
262-
263-
else
264-
${PYTHON_BIN} -m pip install ${PIP_ARGS} -e .[dev]
264+
${PYTHON_BIN} -m pip install ${PIP_ARGS} -e ${FIREWHEEL_ROOT_DIR}/[format,docs]
265+
${PYTHON_BIN} -m pip install ${PIP_ARGS} -e ${MC_DIR}/firewheel_repo_base
266+
${PYTHON_BIN} -m pip install ${PIP_ARGS} -e ${MC_DIR}/firewheel_repo_linux
267+
${PYTHON_BIN} -m pip install ${PIP_ARGS} -e ${MC_DIR}/firewheel_repo_vyos
265268
fi
266-
popd
267269
}
268270

269271
#######################################
@@ -386,8 +388,8 @@ function main() {
386388
echo "${fw_str} Installing FIREWHEEL in development mode."
387389
install_firewheel_development $clone
388390
else
389-
echo "${fw_str} Installing FIREWHEEL without development dependencies."
390-
install_firewheel
391+
echo "${fw_str} Installing FIREWHEEL with standard (non-development) dependencies."
392+
install_firewheel $clone
391393
fi
392394
echo "${fw_str} Setting configuration options."
393395
init_firewheel $static

0 commit comments

Comments
 (0)