Skip to content

Commit

Permalink
Merge pull request #615 from NREL/UrbanOpt50
Browse files Browse the repository at this point in the history
Urban opt50
  • Loading branch information
nllong authored Feb 1, 2021
2 parents f86d1ba + 327a709 commit 7aa10d3
Show file tree
Hide file tree
Showing 73 changed files with 72,911 additions and 979 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ ENV OS_BUNDLER_VERSION=2.1.0
# Set the rails env var
ENV RAILS_ENV $rails_env

# extension gem testing
#ENV FAVOR_LOCAL_GEMS 1

#### OpenStudio Server Code
# First upload the Gemfile* so that it can cache the Gems -- do this first because it is slow
ADD /bin /opt/openstudio/bin
Expand Down Expand Up @@ -156,4 +159,4 @@ RUN chmod +x /usr/local/bin/run-server-tests

# Test adding the git repo to the container for coveralls
# The #TEST# will be removed in the travis test script to be run in the test container
#TEST#COPY .git /opt/openstudio/.git
#TEST#COPY .git /opt/openstudio/.git
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Windows Build (Under Development): [![Build status][appveyor-img]][appveyor-url]

The below documentation has not been recently reviewed. Please refer to the [wiki](https://github.com/NREL/OpenStudio-server/wiki) for current documentation.

## Application Development and Deployment:
## Application Development and Deployment

There are primarily three ways to utilize and deploy this codebase.

Expand All @@ -20,7 +20,7 @@ orchestration engine which allows for multi-node clusters and provides significa
customization and hardening of network and storage
fundamentals.

### openstudio_meta:
### openstudio_meta

The [openstudio_meta](./bin/openstudio_meta) file is a ruby script which provides access to packaging and execution
commands which allow for this codebase to be embedded in applications deployed to computers without docker. Deployment
Expand All @@ -40,7 +40,7 @@ Spreadsheet (the Spreadsheet) or the Parametric Assessment Tool (PAT). The Sprea
submitting analyses to servers, and PAT makes complete use of the openstudio_meta features. For more details, please
refer to the [wiki](https://github.com/NREL/OpenStudio-server/wiki/CLI).

### Local Docker Development:
### Local Docker Development

To develop locally the following dependency stack is recommended.

Expand All @@ -61,7 +61,7 @@ To develop locally the following dependency stack is recommended.

#### Run Docker Compose

```
```bash
docker-compose build
```
... [be patient](https://www.youtube.com/watch?v=f4hkPn0Un_Q) ... If the containers build successfully start them by
Expand All @@ -70,7 +70,8 @@ where 4 is equal to the number of worker nodes you wish to run. For single node
than the total number of available cores minus 4.

Resetting the containers can be accomplished by running:
```

```bash
docker-compose rm -f
docker volume rm osdata dbdata
docker volume create --name=osdata
Expand All @@ -86,24 +87,26 @@ Congratulations! Visit `http://localhost:8080` to see the OpenStudio Server Mana

#### Running the Docker CI testing locally

```
```bash
export OPENSTUDIO_TAG=develop
export RAILS_ENV=docker-test

docker-compose rm -f
docker volume rm osdata
docker volume create --name=osdata
export RAILS_ENV=docker-test
sed -i -E "s/.git//g" .dockerignore
docker-compose -f docker-compose.test.yml build --build-arg OPENSTUDIO_VERSION=develop
docker-compose -f docker-compose.test.yml run web
# in another terminal (or detach previous commands)
docker-compose -f docker-compose.test.yml run worker
git checkout -- Dockerfile .dockerignore
docker volume create --name=osdata
docker-compose -f docker-compose.test.yml pull
docker-compose -f docker-compose.test.yml build --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_TAG
docker-compose -f docker-compose.test.yml up -d
docker-compose exec -T web /usr/local/bin/run-server-tests
docker-compose stop
git checkout -- .dockerignore && git checkout -- Dockerfile
docker-compose rm -f
```



### Docker Deployment:
### Docker Deployment

To deploy the OpenStudio Server in a docker-based production environment one or more machines need to be running Docker
Server version 17.9.01. If using docker on a Linux machine it is recommended that significant storage be available to
Expand All @@ -119,7 +122,7 @@ base AMI images, as well as the scripts used to provision the [server](https://g
and [worker](https://github.com/NREL/OpenStudio-server/blob/develop/docker/deployment/scripts/worker_provision.sh)
nodes upon instantiation in a cluster.

## Testing procedure:
## Testing procedure

The OpenStudio Server project uses several CI systems to test both local and cloud deployments across multiple
platforms. TravisCI is used to build and test local deployments of the server on OSX hardware for each commit, as well
Expand All @@ -142,16 +145,16 @@ PR and push. All of these tests write verbose results and logs on failure, which
of the bug and subsequent fixes. In the case of a failure of the CI infrastructure, please open an issue in the
repository regarding the failure.

## Commands to update gems used in PAT manually:
## Commands to update gems used in PAT manually

To test the impact of upgraded gems on PAT's functionality the currently recommended path is to manually remove and
recreate the cached set of gems, including compiled binary components. This process is platform specific. Currently
instructions are only available for OSX, due to complications compiling the binary component of gems with the ruby
instillation provided in the OpenStudio installer package.

### OSX:
### OSX

```
```bash
# Change directory to the install location of the Server
cd /Applications/OpenStudio-X.Y.Z/ParametricAnalysisTool.app/Contents/Resources/OpenStudio-server
rm -rf /gems # Remove the pre-packaged gems
Expand All @@ -163,7 +166,7 @@ chmod -R 777 gems # Modify privileges on the installed gems

## Questions?

Please contact @tcoleman, @bball, or @nllong with any question regarding this project. Thanks for you interest!
Please contact @tijcolem, @bball, or @nllong with any question regarding this project. Thanks for you interest!

[coveralls-img]: https://coveralls.io/repos/github/NREL/OpenStudio-server/badge.svg?branch=dockerize
[coveralls-url]: https://coveralls.io/github/NREL/OpenStudio-server
Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ artifacts:
- path: 'export/*.tar.gz' #relative to root of repo
name: oss.tar.gz

# init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

clone_folder: C:\projects\openstudio-server

Expand All @@ -35,6 +35,6 @@ test_script:
- cmd: C:\projects\openstudio-server\ci\appveyor\build_package.cmd #artifact upload occurs before on_finish
on_finish:
- cmd: C:\projects\openstudio-server\ci\appveyor\print_logs.cmd
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
on_failure:
- cmd: C:\projects\openstudio-server\ci\appveyor\print_logs.cmd
8 changes: 7 additions & 1 deletion docker/R/lib/api_create_datapoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,14 @@

# load in the objective functions by accessing the objectives file
# that were uploaded when the datapoint completed
begin
a = RestClient.post "#{options[:host]}/data_points/#{datapoint_id}/download_report.json", data_point: { filename: 'objectives' }
a = JSON.parse(a, symbolize_names: true)
rescue => e
puts "error #{e.message}"
break #at this point, simulation completed normal, but objectives failed, so dont try again. break and be done with it.
end

a = JSON.parse(a, symbolize_names: true)
# JSON will be form of:
# {
# "objective_function_1": 24.125,
Expand Down
4 changes: 2 additions & 2 deletions docker/R/lib/create_and_run_datapoint_uniquegroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# rails_analysis_id
# ruby_command
# r_scripts_path
create_and_run_datapoint_uniquegroups <- function(x){
create_and_run_datapoint <- function(x){
options(warn=-1)
if (check_run_flag(r_scripts_path, rails_host, rails_analysis_id, debug_messages)==FALSE){
options(warn=0)
Expand All @@ -53,7 +53,7 @@ create_and_run_datapoint_uniquegroups <- function(x){
# convert the vector to comma separated values
force(x)
w <- paste(x, collapse=",")
y <- paste(r_scripts_path,'/api_create_datapoint.rb -h ',rails_host,' -a ',rails_analysis_id,' -v ',w,' --submit',sep='')
y <- paste(r_scripts_path,'/api_create_datapoint.rb -h ',rails_host,' -a ',rails_analysis_id,' -v ',w,' --submit', sep='')
if(debug_messages == 1){
print(paste('run command: ruby ', y))
}
Expand Down
Loading

0 comments on commit 7aa10d3

Please sign in to comment.