Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle enablement for Oscli PR #381

Merged
merged 4 commits into from
Aug 8, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ vagrant
/server/spec/runs.txt
/server/spec/files/tmp/
/server/spec/files/test_model/tmp_run_single
/spec/unit-test
/spec
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

/worker-nodes
11 changes: 2 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@
# TO_BUILD_AND_RUN: docker-compose up
# NOTES: Currently this is one big dockerfile and non-optimal.


ARG OPENSTUDIO_VERSION=2.6.1
FROM nrel/openstudio:$OPENSTUDIO_VERSION as base
MAINTAINER Nicholas Long nicholas.long@nrel.gov

#ARG not available after from, so we need to set this again. Maybe we should set as an ENV in the openstudio Docker container?
ARG OPENSTUDIO_VERSION=2.6.1
# The OpenStudio Gemfile contains a fixed bundler version, so you have to install and run specific to that version
ARG OS_BUNDLER_VERSION=1.14.4
RUN ruby -r openstudio -e "require 'openstudio'; puts OpenStudio.openStudioLongVersion" && \
gem install bundler -v $OS_BUNDLER_VERSION && \
bundle _${OS_BUNDLER_VERSION}_ install --gemfile=/usr/local/openstudio-${OPENSTUDIO_VERSION}/Ruby/Gemfile

# Install required libaries.
# realpath - needed for wait-for-it
RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
Expand Down Expand Up @@ -91,7 +84,7 @@ ENV RAILS_ENV $rails_env
ADD /bin /opt/openstudio/bin
ADD /server/Gemfile /opt/openstudio/server/Gemfile
WORKDIR /opt/openstudio/server
RUN bundle install --jobs=3 --retry=3 $bundle_args
RUN bundle _${OS_BUNDLER_VERSION}_ install --jobs=3 --retry=3 $bundle_args

# Add the app assets and precompile assets. Do it this way so that when the app changes the assets don't
# have to be recompiled everytime
Expand Down
1 change: 0 additions & 1 deletion docker/deployment/scripts/aws_osserver_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ echo ""
sleep 1
docker volume create --name=osdata
docker volume create --name=dbdata
sleep 1
6 changes: 4 additions & 2 deletions server/app/workers/run_simulate_data_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ def perform
File.open(run_log_file, 'a') do |run_log|
begin
# use bundle option only if we have a path to openstudio gemfile. expect this to be
bundle = Rails.application.config.os_gemfile_path.present? ? "--bundle #{Rails.application.config.os_gemfile_path} ": ""
cmd = "#{@options[:openstudio_executable]} run --workflow #{osw_path} --debug #{bundle}"
bundle = Rails.application.config.os_gemfile_path.present? ? "--bundle "\
"#{File.join Rails.application.config.os_gemfile_path, 'Gemfile'} --bundle_path "\
"#{File.join Rails.application.config.os_gemfile_path, 'gems'} --verbose " : ""
cmd = "#{@options[:openstudio_executable]} #{bundle}run --workflow #{osw_path} --debug"
@sim_logger.info "Running workflow using cmd #{cmd}"

# TODO confirm that any ENV variables that we want OSS to use are set correctly, probably pass explicitly to spawn
Expand Down
2 changes: 1 addition & 1 deletion server/config/environments/docker-dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@

# detect os version build path to gemfile. this is passed to cli as --bundle
os_version = `openstudio openstudio_version`
config.os_gemfile_path = "/usr/local/openstudio-#{os_version.slice(0,os_version.rindex('.'))}/Ruby/Gemfile"
config.os_gemfile_path = "/var/oscli"
end
2 changes: 1 addition & 1 deletion server/config/environments/docker-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@

# detect os version build path to gemfile. this is passed to cli as --bundle
os_version = `openstudio openstudio_version`
config.os_gemfile_path = "/usr/local/openstudio-#{os_version.slice(0,os_version.rindex('.'))}/Ruby/Gemfile"
config.os_gemfile_path = "/var/oscli"
end
2 changes: 1 addition & 1 deletion server/config/environments/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@

# detect os version build path to gemfile. this is passed to cli as --bundle
os_version = `openstudio openstudio_version`
config.os_gemfile_path = "/usr/local/openstudio-#{os_version.slice(0,os_version.rindex('.'))}/Ruby/Gemfile"
config.os_gemfile_path = "/var/oscli"
end