-
Notifications
You must be signed in to change notification settings - Fork 13
Development
Alfalfa leverages containers for running code and thus has only a few prerequisites for development
- Clone Alfalfa repository
git clone [email protected]:NREL/alfalfa.git
- Enter the repository folder
cd alfalfa
- Install Python dependencies
poetry install
Alfalfa has several configurations in which it can be run. These can be selected by using combinations of the docker-compose.yml
files in the repo.
-
docker-compose.yml
is the base compose file needed for all alfalfa deployments -
docker-compose.dev.yml
adds auto reloading and rebuilding of worker and web containers on source code changes -
docker-compose.historian.yml
adds influxdb and grafana for recording timeseries data and plotting
For documentation on docker compose
command see here.
Build Alfalfa images for base compose file.
Run Alfalfa from base compose file. --build
can be added to any up
command to rebuild any changes, this insures that the images are up to date. -d
runs the containers in detached mode.
Delete containers and associated volumes. Clears all databases, good for cleaning house every now and then.
Run alfalfa with auto reloading and rebuilding of worker and web containers when source code is updated. --build
will rebuild images before running.
- Start services for Alfalfa
docker compose up -d mongo redis minio mc goaws
- Run unit tests
poetry run pytest
-
Run docker dev stack locally (in detached mode)
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d
-
Run simulation tests
docker exec alfalfa_worker_1 bash -c "cd /alfalfa && pytest -m docker tests/jobs"
-
Clean up stack
docker compose down
- Run stack locally in detached mode
docker compose up --build -d
- Run integration tests
poetry run pytest -m "integration"
- Clean up stack
docker compose down
- Release dependent projects as needed (e.g., alfalfa-client).
- Update version in
pyproject.toml
,package.json
and pointalfalfa-client
dependency inpyproject.toml
to point to releasedalfalfa-client
- Create a PR with the release prep branch against
develop
. - Update the change log. It is easiest to use GitHub's "Generate Release Notes" which is accessible on the Draft New Release Page. Add in a tag and target (to the release prep branch), then click on the "Generate Release Notes".
- Wait for tests to pass
- Merge to
develop
- Create a tag on
develop
with the formatvX.X.X
- Create PR against
main
. - Wait for tests and MERGE PR (squashing or rebasing will lead to strange behavior between
main
anddevelop
) - After merge to
main
images will automatically be released to Docker Hub under the following images. It is recommended to verify that these images are updated (which can take up to an hour).
- Release drafted release in Alfalfa repo
- Celebrate!
- Getting Started with Model Measures Part 1: Creating Inputs and Outputs
- Getting Started with Model Measures Part 2: Creating Actuators
- Getting Started with EnergyPlus Measures Part 1: Creating Inputs and Outputs
- Getting Started with EnergyPlus Measures Part 2: Creating Actuators
- How to Configure an OpenStudio Model
- How to Configure Measures for Use with Alfalfa Ruby Gem
- How to Create Inputs and Outputs With Measures
- How to Run URBANopt Output Models in Alfalfa
- How to Migrate EnergyPlus Python Plugins
- How to Integrate Python based Electric Vehicle Models with OpenStudio Workflows
- How to Locally Test OpenStudio Models
- Required Structure of OpenStudio Workflow
- List of Automatically Generated Energyplus Points
- Alfalfa EnergyPlus Mixin Methods
- Getting Started with Uploading and Running a Model Using Python
- Getting Started with Uploading and Running a Model Using the UI
- How to Install Alfalfa Client
- How to Preprocess and Upload a Model
- How to Step Through a Simulation
- How to View Historical Data in Grafana
- How to Configure an Alias
- How to Troubleshoot Models