Skip to content

Commit

Permalink
Merge pull request #362 from NREL/develop
Browse files Browse the repository at this point in the history
0.4.0 Release
  • Loading branch information
anyaelena authored Sep 30, 2022
2 parents b68e167 + 4242e26 commit c90d064
Show file tree
Hide file tree
Showing 106 changed files with 19,618 additions and 5,728 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
__pycache__
.pytest_cache
.tox
.vscode
.coverage
dist
docs
tox.ini
Dockerfile

alfalfa_web/Dockerfile
alfalfa_web/build
alfalfa_web/node_modules
alfalfa_web/.config
alfalfa_web/.npm

alfalfa_worker/Dockerfile

# local files created when running
# locally for development
*.tar.gz
wrapped_result.mat
/*.log
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ INFLUXDB_HTTP_AUTH_ENABLED=true
JOB_QUEUE_URL=http://goaws:4100/queue/local-queue1
LOGGING=false
MONGO_DB_NAME=alfalfa
MONGO_URL=mongodb://mongo:27017/
MONGO_URL=mongodb://mongo:27017
NODE_ENV=production
REDIS_HOST=redis
REGION=us-west-1
Expand Down
63 changes: 41 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: CI

on:
pull_request:
push:
# Reenable pull_request if we start receiving 3rd party contributions.
# Otherwise all pull_requests will also be push test and we are enforcing
# that code must be up to date with parent in the PRs.
#pull_request:

jobs:
pre-commit:
Expand All @@ -16,7 +19,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"

- name: Run pre-commit
uses: pre-commit/[email protected]
Expand All @@ -31,43 +34,53 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Start MongoDB
uses: supercharge/[email protected]
# Defaults to the latest version of MongoDB

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.12
# use a newer version of poetry in this test, but
# poetry in the dockerfile is a bit older because
# of a urllib3 issue
poetry-version: 1.2.1

- name: Run tests with pytest
- name: Install poetry dependencies
run: |
poetry install
- name: Runner Details
run: |
cat /etc/issue
python --version
- name: Run tests with pytest
run: |
poetry run pytest
simulation-tests:
name: Run simulation tests
name: Run simulation tests in worker
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v2

# only need to start the worker which saves time here because
# the webpack calling on the web container for .dev.yml can take some
# time.
- name: Build and run stack
run: |
printenv
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d
- name: Wait for web server
uses: nev7n/wait_for_response@v1
with:
url: "http://localhost/"
responseCode: 200
timeout: 120000
interval: 500
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d worker
- name: Wait another 30s
- name: Wait another 30s for the containers to start
uses: jakejarvis/wait-action@master
with:
time: "30s"
Expand Down Expand Up @@ -98,12 +111,15 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.12
# use a newer version of poetry in this test, but
# poetry in the dockerfile is a bit older because
# of a urllib3 issue
poetry-version: 1.2.1

- name: Build and run stack
run: |
Expand All @@ -129,7 +145,7 @@ jobs:
- name: Run tests with pytest
run: |
poetry install
poetry run pytest --timeout=240 -m "integration"
poetry run pytest --timeout=600 -m "integration"
- name: Dump docker logs on failure
if: failure()
Expand All @@ -146,12 +162,15 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.8"

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.12
# use a newer version of poetry in this test, but
# poetry in the dockerfile is a bit older because
# of a urllib3 issue
poetry-version: 1.2.1

- name: Build and run stack
run: |
Expand All @@ -178,7 +197,7 @@ jobs:
- name: Run tests with pytest
run: |
poetry install
poetry run pytest --timeout=240 -m "integration"
poetry run pytest --timeout=600 -m "integration"
- name: Dump docker logs on failure
if: failure()
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/alfalfa_web/build
/alfalfa_worker/build
/docs/resources
*.hbs
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2008-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
Copyright (c) 2018-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Alfalfa
# Alfalfa Virtual Building Service

Alfalfa is an open source web application forged in the melting pot of Building Energy Modeling (BEM), Building Controls, and Software Engineering domain expertise. Alfalfa transforms Building Energy Models (BEMs) into virtual buildings by providing industry standard building control interfaces for interacting with models as they run. From a software engineering perspective, Alfalfa leverages widely adopted open source products and is architected according to best practices for a robust, modular, and scalable architecture.

Expand Down
8 changes: 0 additions & 8 deletions alfalfa_web/.dockerignore

This file was deleted.

15 changes: 5 additions & 10 deletions alfalfa_web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@ ARG NODE_ENV
RUN npm run build
CMD [ "npm", "start" ]


# **** Staged build for running in development mode - Still WIP****
# **** Staged build for running in development mode ****
FROM base AS dev

# The docker-compose will require the mounting
# of the files into the container, see docker-compose.dev.yml

# Enable the ability to restart the service when
# the files change
RUN npm install watch
COPY deploy/build_web.sh /srv/scripts/
RUN chmod +x /srv/scripts/build_web.sh
# install nodemon to restart the service when the files change
RUN npm install -g nodemon

ENTRYPOINT /srv/scripts/build_web.sh
WORKDIR /srv/alfalfa

# Run in watch mode so it will automatically restart
# CMD [ "watch", "'npm run build'" "/srv/alfalfa" ]
CMD [ "npm", "start" ]
CMD [ "npm", "run", "watch" ]
4 changes: 4 additions & 0 deletions alfalfa_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Install and build the packages, then run locally using webpack to rebuild the UI as files are modified:

```bash
# if using nvm, then set to the same version that is in the dockerfile (install with `nvm install 16.17.0`)
nvm use 16.17.0

# install dependencies
npm install
npm run build-server
npm run start-dev
Expand Down
25 changes: 0 additions & 25 deletions alfalfa_web/app.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/***********************************************************************************************************************
* Copyright (c) 2008-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
* derived from this software without specific prior written permission from the respective party.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
import "@fontsource/material-icons";
import "@fontsource/roboto";
Expand Down
36 changes: 6 additions & 30 deletions alfalfa_web/components/App/App.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,11 @@
/***********************************************************************************************************************
* Copyright (c) 2008-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
* derived from this software without specific prior written permission from the respective party.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

import { AdapterLuxon } from "@mui/x-date-pickers/AdapterLuxon";
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
import { AppBar, Grid, Toolbar, Typography } from "@mui/material";
import { createTheme, ThemeProvider } from "@mui/material/styles";
import { withStyles } from "@mui/styles";
import PropTypes from "prop-types";
import React from "react";
import { Link, Route, Routes } from "react-router-dom";
import { Link, Navigate, Route, Routes } from "react-router-dom";
import Sims from "../Sims/Sims";
import Sites from "../Sites/Sites";
import Upload from "../Upload/Upload";
Expand Down Expand Up @@ -68,9 +43,9 @@ class App extends React.Component {
</Link>
<Grid container justifyContent="flex-end" spacing={2} style={{ marginLeft: 0 }}>
<Grid item>
<Link to={"/models"} style={{ textDecoration: "none", color: "unset" }}>
<Link to={"/sites"} style={{ textDecoration: "none", color: "unset" }}>
<Typography className={classes.button} variant="button" color="inherit">
Models
Sites
</Typography>
</Link>
</Grid>
Expand All @@ -86,8 +61,9 @@ class App extends React.Component {
</AppBar>
<Routes>
<Route path="/" element={<Upload />} />
<Route path="models" element={<Sites />} />
<Route path="sims" element={<Sims />} />
<Route path="/sites" element={<Sites />} />
<Route path="/sims" element={<Sims />} />
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</div>
</LocalizationProvider>
Expand Down
25 changes: 0 additions & 25 deletions alfalfa_web/components/Sims/Sims.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/***********************************************************************************************************************
* Copyright (c) 2008-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
* derived from this software without specific prior written permission from the respective party.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

import { gql } from "@apollo/client";
import { graphql } from "@apollo/client/react/hoc";
import { MoreVert } from "@mui/icons-material";
Expand Down
25 changes: 0 additions & 25 deletions alfalfa_web/components/Sites/PointDialogComponent.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/***********************************************************************************************************************
* Copyright (c) 2008-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
* derived from this software without specific prior written permission from the respective party.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

import { ExpandMore } from "@mui/icons-material";
import {
Accordion,
Expand Down
Loading

0 comments on commit c90d064

Please sign in to comment.