-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
openstudiocore/ruby/openstudio/runmanager/test/RubyWorkflow_Test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
###################################################################### | ||
# Copyright (c) 2008-2016, Alliance for Sustainable Energy. | ||
# All rights reserved. | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
###################################################################### | ||
|
||
require 'openstudio' | ||
require 'minitest/autorun' | ||
|
||
class RubyWorkflow_Test < MiniTest::Unit::TestCase | ||
|
||
def test_Workflow | ||
|
||
# General setup | ||
epw_path = OpenStudio::Path.new($OpenStudio_ResourcePath + "runmanager/USA_CO_Golden-NREL.724666_TMY3.epw") | ||
|
||
# Get energyplus configuration | ||
co = OpenStudio::Runmanager::ConfigOptions.new(true) | ||
co.fastFindEnergyPlus() | ||
co.fastFindRuby() | ||
|
||
# Generate some reasonable output directory name | ||
outdir = OpenStudio::tempDir() / OpenStudio::Path.new("rubyworkflow") | ||
osm_path = outdir / OpenStudio::Path.new("in.osm") | ||
OpenStudio::Model::exampleModel().save(osm_path, true) | ||
|
||
# Create a new workflow. We are going to take advantage of the string processor | ||
# constructor to help us kick start the first two parts | ||
#workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf") | ||
workflow = OpenStudio::Runmanager::Workflow.new("modeltoidf->energyplus") | ||
|
||
# DLM: this does not work for reporting measures, issue #2021 | ||
# DLM: actually this does appear to work, it just outputs an error message saying it doesn't | ||
standardReportMeasure = OpenStudio::BCLMeasure.standardReportMeasure | ||
rubyjobbuilder = OpenStudio::Runmanager::RubyJobBuilder.new(standardReportMeasure) | ||
rubyjobbuilder.setIncludeDir(OpenStudio::Path.new($OpenStudio_Dir)) | ||
|
||
# Add it to the workflow | ||
workflow.addJob(rubyjobbuilder.toWorkItem()) | ||
|
||
# Set up the basic general tools needed. This takes care of EnergyPlus, XMLPreprocessor, Radiance, Ruby | ||
workflow.add(co.getTools) | ||
|
||
# Create a runmanager | ||
run_manager = OpenStudio::Runmanager::RunManager.new(OpenStudio::tempDir() / OpenStudio::Path.new("rubyworkflow.db"), true) | ||
|
||
# create the job tree | ||
jobtree = workflow.create(outdir, osm_path, epw_path) | ||
|
||
# run the job tree | ||
run_manager.enqueue(jobtree, true) | ||
|
||
# wait until done | ||
run_manager.waitForFinished() | ||
|
||
# get path of report | ||
puts jobtree.treeOutputFiles().getLastByFilename("report.html").fullPath.to_s | ||
|
||
end | ||
end |
1ce7ebc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (macumber) - x86_64-Linux-Ubuntu-14.04-clang-3.5: OK (2362 of 2419 tests passed, 0 test warnings)
1ce7ebc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (macumber) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed, 0 test warnings)
1ce7ebc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (macumber) - x86_64-MacOS-10.10-clang: OK (2380 of 2419 tests passed, 0 test warnings)
1ce7ebc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (macumber) - i386-Windows-7-VisualStudio-12: Tests Failed (2157 of 2419 tests passed, 0 test warnings)
1ce7ebc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (macumber) - Win64-Windows-7-VisualStudio-12: OK (2400 of 2419 tests passed, 0 test warnings)