openstudio-workflow 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +72 -72
- data/README.md +93 -48
- data/Rakefile +36 -36
- data/lib/openstudio-workflow.rb +49 -49
- data/lib/openstudio/workflow/adapters/input/local.rb +244 -240
- data/lib/openstudio/workflow/adapters/output/local.rb +95 -95
- data/lib/openstudio/workflow/adapters/output/socket.rb +91 -91
- data/lib/openstudio/workflow/adapters/output/web.rb +66 -66
- data/lib/openstudio/workflow/adapters/output_adapter.rb +147 -147
- data/lib/openstudio/workflow/job.rb +22 -22
- data/lib/openstudio/workflow/jobs/resources/monthly_report.idf +222 -222
- data/lib/openstudio/workflow/jobs/run_energyplus.rb +49 -49
- data/lib/openstudio/workflow/jobs/run_ep_measures.rb +55 -55
- data/lib/openstudio/workflow/jobs/run_initialization.rb +169 -167
- data/lib/openstudio/workflow/jobs/run_os_measures.rb +69 -69
- data/lib/openstudio/workflow/jobs/run_postprocess.rb +53 -53
- data/lib/openstudio/workflow/jobs/run_preprocess.rb +69 -69
- data/lib/openstudio/workflow/jobs/run_reporting_measures.rb +98 -98
- data/lib/openstudio/workflow/jobs/run_translation.rb +61 -61
- data/lib/openstudio/workflow/multi_delegator.rb +46 -46
- data/lib/openstudio/workflow/registry.rb +137 -137
- data/lib/openstudio/workflow/run.rb +299 -299
- data/lib/openstudio/workflow/time_logger.rb +53 -53
- data/lib/openstudio/workflow/util.rb +14 -14
- data/lib/openstudio/workflow/util/energyplus.rb +566 -564
- data/lib/openstudio/workflow/util/io.rb +33 -33
- data/lib/openstudio/workflow/util/measure.rb +588 -588
- data/lib/openstudio/workflow/util/model.rb +100 -100
- data/lib/openstudio/workflow/util/post_process.rb +187 -187
- data/lib/openstudio/workflow/util/weather_file.rb +108 -108
- data/lib/openstudio/workflow/version.rb +24 -24
- data/lib/openstudio/workflow_json.rb +426 -426
- data/lib/openstudio/workflow_runner.rb +233 -215
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36393e28da7642fc75d1e780e913c86f43c46548
|
4
|
+
data.tar.gz: a9474bab185e5f286258129e73a58c5718a95ffd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4079a380d92cfff3fa7fd60454babbb768517ec7ecb182d27b29af37508629bb668db2fce62aa3127121bc9d9e0ee02966c1eb36262ae9f95e340ce413b95d4
|
7
|
+
data.tar.gz: 36153a1892dd12bfb4d0dca47c32ca8a7f6a6bd0770a367d317c98ed9a8d82e3ec7edf1f15c429f69a319dca858d89db3f2a82cf9b9d8cc45f93b8a80dd5828c
|
data/CHANGELOG.md
CHANGED
@@ -1,72 +1,72 @@
|
|
1
|
-
OpenStudio::Workflow Change Log
|
2
|
-
==================================
|
3
|
-
|
4
|
-
Version '1.0.0-rc1' (Not released)
|
5
|
-
-------------------
|
6
|
-
* Use specific version of OpenStudio Analysis Gem
|
7
|
-
* Fix tests
|
8
|
-
* Remove to_underscore method (use OpenStudio.toUnderscoreCase(...) if needed)
|
9
|
-
|
10
|
-
Version '1.0.0-alpha.0'
|
11
|
-
-----------------------
|
12
|
-
* Support new workflow for PAT 2.0. Many of these changes are breaking changes
|
13
|
-
* Remove rake from gemspec
|
14
|
-
* Update rubyzip to version 1.2
|
15
|
-
|
16
|
-
Version 0.2.0
|
17
|
-
------------------
|
18
|
-
* Use EnergyPlus that is packaged with OpenStudio. The branch of this repo is no longer tied to the version of EnergyPlus
|
19
|
-
* Update find_energyplus to use new OpenStudio method instead of RUBYLIB env var
|
20
|
-
* Update dependencies
|
21
|
-
* Support tests running on Docker
|
22
|
-
* Skip the PAT tests for now since they are broken
|
23
|
-
* Remove snake_case method as it conflicts with another libraries method, now called to_underscore
|
24
|
-
* Add test for persisting JSONs as reports. Rename reports in the form of <measure_name_underscored>_<report_name>.<ext>
|
25
|
-
* Always add in Monthly Reports (Deprecate the :run_monthly_reports option)
|
26
|
-
* Remove the old Standard Reports and use the version in the OpenStudio Release (along with the calibration report)
|
27
|
-
|
28
|
-
Version 0.1.1
|
29
|
-
------------------
|
30
|
-
* Catch exception when loading a measure file.
|
31
|
-
* Enable running simulations on windows and mac
|
32
|
-
* Use rubyzip gem instead of system call
|
33
|
-
* Fix the double directory which caused the zip files to behave strangely on windows
|
34
|
-
* New find_energyplus method which tries to use OpenStudio's version of EnergyPlus
|
35
|
-
* Copy all EnergyPlus files into run directory
|
36
|
-
* Better cleanup after EnergyPlus simulation
|
37
|
-
* Read machine information from /etc/openstudio-server directory, if available
|
38
|
-
|
39
|
-
Version 0.1.0
|
40
|
-
-------------
|
41
|
-
* Tests for programmatically creating the analysis.json files from the OpenStudio-analysis-gem
|
42
|
-
* Upgrade to EnergyPlus 8.2. Right now the run energyplus and run runmanager job hard code these paths.
|
43
|
-
* Upgrade and fix Facter facts to grab the correct ip address when running on EC2
|
44
|
-
|
45
|
-
Version 0.0.4
|
46
|
-
-------------
|
47
|
-
* Include rubyXL gem for reading/writing MS Excel files
|
48
|
-
* Remove invalid characters from OpenStudio Measure Attributes. /[|!@#\$%^&\*\(\)\{\}\\\[\]|;:'",<.>\/?\+=]+/
|
49
|
-
* Fix objective functions to read from any of the results hash, not just the standard report legacy
|
50
|
-
* Add time logger and reporting measure
|
51
|
-
|
52
|
-
Version 0.0.3
|
53
|
-
--------------
|
54
|
-
* Allow measures to set weather file in a measure and have it update what EnergyPlus uses for the weather file.
|
55
|
-
* OpenStudio::Workflow.run_energyplus method added to just run energyplus.
|
56
|
-
* Remove AASM (act as state machine) and replace with simple tracking of the state. Interface is the same except there is now no need to pass in the States.
|
57
|
-
* Catch EnergyPlus errors (non-zero exits), Fatal Errors in eplusout.err, and invalid weather files.
|
58
|
-
* Force UTF-8 version upon reading the eplusout.err file
|
59
|
-
|
60
|
-
Version 0.0.2
|
61
|
-
--------------
|
62
|
-
|
63
|
-
* Support reporting measures
|
64
|
-
* Reduce logging messages
|
65
|
-
* Keep IDF files
|
66
|
-
* Remove mtr and eso files after simulation completes
|
67
|
-
* If measure changes weather file, then use the new weather file with the analysis.json weather path
|
68
|
-
|
69
|
-
Version 0.0.1
|
70
|
-
--------------
|
71
|
-
|
72
|
-
* Initial release with basic workflow implemented to support running OpenStudio measure-based workflows
|
1
|
+
OpenStudio::Workflow Change Log
|
2
|
+
==================================
|
3
|
+
|
4
|
+
Version '1.0.0-rc1' (Not released)
|
5
|
+
-------------------
|
6
|
+
* Use specific version of OpenStudio Analysis Gem
|
7
|
+
* Fix tests
|
8
|
+
* Remove to_underscore method (use OpenStudio.toUnderscoreCase(...) if needed)
|
9
|
+
|
10
|
+
Version '1.0.0-alpha.0'
|
11
|
+
-----------------------
|
12
|
+
* Support new workflow for PAT 2.0. Many of these changes are breaking changes
|
13
|
+
* Remove rake from gemspec
|
14
|
+
* Update rubyzip to version 1.2
|
15
|
+
|
16
|
+
Version 0.2.0
|
17
|
+
------------------
|
18
|
+
* Use EnergyPlus that is packaged with OpenStudio. The branch of this repo is no longer tied to the version of EnergyPlus
|
19
|
+
* Update find_energyplus to use new OpenStudio method instead of RUBYLIB env var
|
20
|
+
* Update dependencies
|
21
|
+
* Support tests running on Docker
|
22
|
+
* Skip the PAT tests for now since they are broken
|
23
|
+
* Remove snake_case method as it conflicts with another libraries method, now called to_underscore
|
24
|
+
* Add test for persisting JSONs as reports. Rename reports in the form of <measure_name_underscored>_<report_name>.<ext>
|
25
|
+
* Always add in Monthly Reports (Deprecate the :run_monthly_reports option)
|
26
|
+
* Remove the old Standard Reports and use the version in the OpenStudio Release (along with the calibration report)
|
27
|
+
|
28
|
+
Version 0.1.1
|
29
|
+
------------------
|
30
|
+
* Catch exception when loading a measure file.
|
31
|
+
* Enable running simulations on windows and mac
|
32
|
+
* Use rubyzip gem instead of system call
|
33
|
+
* Fix the double directory which caused the zip files to behave strangely on windows
|
34
|
+
* New find_energyplus method which tries to use OpenStudio's version of EnergyPlus
|
35
|
+
* Copy all EnergyPlus files into run directory
|
36
|
+
* Better cleanup after EnergyPlus simulation
|
37
|
+
* Read machine information from /etc/openstudio-server directory, if available
|
38
|
+
|
39
|
+
Version 0.1.0
|
40
|
+
-------------
|
41
|
+
* Tests for programmatically creating the analysis.json files from the OpenStudio-analysis-gem
|
42
|
+
* Upgrade to EnergyPlus 8.2. Right now the run energyplus and run runmanager job hard code these paths.
|
43
|
+
* Upgrade and fix Facter facts to grab the correct ip address when running on EC2
|
44
|
+
|
45
|
+
Version 0.0.4
|
46
|
+
-------------
|
47
|
+
* Include rubyXL gem for reading/writing MS Excel files
|
48
|
+
* Remove invalid characters from OpenStudio Measure Attributes. /[|!@#\$%^&\*\(\)\{\}\\\[\]|;:'",<.>\/?\+=]+/
|
49
|
+
* Fix objective functions to read from any of the results hash, not just the standard report legacy
|
50
|
+
* Add time logger and reporting measure
|
51
|
+
|
52
|
+
Version 0.0.3
|
53
|
+
--------------
|
54
|
+
* Allow measures to set weather file in a measure and have it update what EnergyPlus uses for the weather file.
|
55
|
+
* OpenStudio::Workflow.run_energyplus method added to just run energyplus.
|
56
|
+
* Remove AASM (act as state machine) and replace with simple tracking of the state. Interface is the same except there is now no need to pass in the States.
|
57
|
+
* Catch EnergyPlus errors (non-zero exits), Fatal Errors in eplusout.err, and invalid weather files.
|
58
|
+
* Force UTF-8 version upon reading the eplusout.err file
|
59
|
+
|
60
|
+
Version 0.0.2
|
61
|
+
--------------
|
62
|
+
|
63
|
+
* Support reporting measures
|
64
|
+
* Reduce logging messages
|
65
|
+
* Keep IDF files
|
66
|
+
* Remove mtr and eso files after simulation completes
|
67
|
+
* If measure changes weather file, then use the new weather file with the analysis.json weather path
|
68
|
+
|
69
|
+
Version 0.0.1
|
70
|
+
--------------
|
71
|
+
|
72
|
+
* Initial release with basic workflow implemented to support running OpenStudio measure-based workflows
|
data/README.md
CHANGED
@@ -1,48 +1,93 @@
|
|
1
|
-
# OpenStudio::Workflow
|
2
|
-
|
3
|
-
[![
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
1
|
+
# OpenStudio::Workflow
|
2
|
+
|
3
|
+
[![Circle CI](https://circleci.com/gh/NREL/OpenStudio-workflow-gem/tree/develop.svg?style=svg)](https://circleci.com/gh/NREL/OpenStudio-workflow-gem/tree/develop)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/NREL/OpenStudio-workflow-gem/badge.svg?branch=develop&service=github)](https://coveralls.io/github/NREL/OpenStudio-workflow-gem?branch=develop)
|
5
|
+
[![Dependency Status](https://www.versioneye.com/user/projects/5531fb7b10e714121100102e/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5531fb7b10e714121100102e)
|
6
|
+
|
7
|
+
## OpenStudio Workflow Gem
|
8
|
+
|
9
|
+
This branch is the development branch for the OpenStudio workflow gem.
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
The OpenStudio Workflow Gem has the following dependencies:
|
13
|
+
|
14
|
+
* Ruby 2.0
|
15
|
+
* OpenStudio with Ruby 2.0 bindings
|
16
|
+
* EnergyPlus 8.3 (assuming OpenStudio >= 1.7.2)
|
17
|
+
* MongoDB if using MongoDB Adapter (or when running rspec)
|
18
|
+
|
19
|
+
[OpenStudio](http://developer.nrel.gov/downloads/buildings/openstudio/builds/) needs to be installed
|
20
|
+
and in your path. On Mac/Linux it is easiest to add the following to your .bash_profile or /etc/profile.d/<file>.sh to ensure OpenStudio can be loaded.
|
21
|
+
|
22
|
+
export OPENSTUDIO_ROOT=/usr/local
|
23
|
+
export RUBYLIB=$OPENSTUDIO_ROOT/lib/ruby/site_ruby/2.0.0
|
24
|
+
|
25
|
+
Add this line to your application's Gemfile:
|
26
|
+
|
27
|
+
gem 'OpenStudio-workflow'
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
Mac/Linux:
|
32
|
+
|
33
|
+
$ bundle
|
34
|
+
|
35
|
+
Windows (avoids native extensions):
|
36
|
+
|
37
|
+
$ bundle install --without xml profile
|
38
|
+
|
39
|
+
Or install it yourself as:
|
40
|
+
|
41
|
+
$ gem install OpenStudio-workflow
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
Note that the branches of the Workflow Gem depict which version of EnergyPlus is in use. The develop branch at the
|
46
|
+
moment should not be used.
|
47
|
+
|
48
|
+
There are currently two adapters to run OpenStudio workflow. The first is a simple Local adapter
|
49
|
+
allowing the user to pass in the directory to simulation. The directory must have an
|
50
|
+
[analysis/problem JSON file](spec/files/local_ex1/analysis_1.json) and a [datapoint JSON file](spec/files/local_ex1/datapoint_1.json).
|
51
|
+
The workflow manager will use these data (and the measures, seed model, and weather data) to assemble and
|
52
|
+
execute the standard workflow of (preflight->openstudio measures->energyplus->postprocess).
|
53
|
+
|
54
|
+
r = OpenStudio::Workflow.load 'Local', '/home/user/a_directory', options
|
55
|
+
r.run
|
56
|
+
|
57
|
+
The workflow manager can also use MongoDB to receive instructions on the workflow to run and the data point values.
|
58
|
+
|
59
|
+
## Caveats and Todos
|
60
|
+
|
61
|
+
### Todos
|
62
|
+
|
63
|
+
* Add a test to ensure that the models being returned contain alterations after apply_measure
|
64
|
+
* Add unit tests for each util method
|
65
|
+
* Define and document the complete set of options for the adapter and run classes
|
66
|
+
* Implement better error handling with custom exception classes
|
67
|
+
|
68
|
+
## Testing
|
69
|
+
|
70
|
+
The preferred way for testing is to run rspec either natively or via docker.
|
71
|
+
|
72
|
+
### Locally
|
73
|
+
|
74
|
+
```
|
75
|
+
rspec spec/
|
76
|
+
```
|
77
|
+
|
78
|
+
### Docker
|
79
|
+
|
80
|
+
```
|
81
|
+
export OPENSTUDIO_VERSION=1.13.0
|
82
|
+
docker run -v $(pwd):/var/simdata/openstudio \
|
83
|
+
nrel/openstudio:$OPENSTUDIO_VERSION \
|
84
|
+
/var/simdata/openstudio/test/bin/docker-run.sh
|
85
|
+
```
|
86
|
+
|
87
|
+
## Contributing
|
88
|
+
|
89
|
+
1. Fork it ( https://github.com/NREL/OpenStudio-workflow/fork )
|
90
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
91
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
92
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
93
|
+
5. Create a new Pull Request
|
data/Rakefile
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler.setup
|
3
|
-
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
# Always create spec reports
|
7
|
-
require 'ci/reporter/rake/rspec'
|
8
|
-
|
9
|
-
# Gem tasks
|
10
|
-
require 'bundler/gem_tasks'
|
11
|
-
|
12
|
-
RSpec::Core::RakeTask.new('spec:unit') do |spec|
|
13
|
-
spec.rspec_opts = %w(--format progress --format CI::Reporter::RSpec)
|
14
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
15
|
-
end
|
16
|
-
|
17
|
-
task 'spec:unit' => 'ci:setup:rspec'
|
18
|
-
task default: 'spec:unit'
|
19
|
-
|
20
|
-
require 'rubocop/rake_task'
|
21
|
-
desc 'Run RuboCop on the lib directory'
|
22
|
-
RuboCop::RakeTask.new(:rubocop) do |task|
|
23
|
-
task.options = ['--no-color', '--out=rubocop-results.xml']
|
24
|
-
task.formatters = ['RuboCop::Formatter::CheckstyleFormatter']
|
25
|
-
task.requires = ['rubocop/formatter/checkstyle_formatter']
|
26
|
-
# don't abort rake on failure
|
27
|
-
task.fail_on_error = false
|
28
|
-
end
|
29
|
-
|
30
|
-
require 'openstudio-workflow'
|
31
|
-
desc 'test extracting zip'
|
32
|
-
task :test_zip do
|
33
|
-
f = File.join(File.dirname(__FILE__), 'spec/files/example_models/the_project.zip')
|
34
|
-
puts "Trying to extract #{f}"
|
35
|
-
OpenStudio::Workflow.extract_archive(f, 'junk_out', true)
|
36
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
# Always create spec reports
|
7
|
+
require 'ci/reporter/rake/rspec'
|
8
|
+
|
9
|
+
# Gem tasks
|
10
|
+
require 'bundler/gem_tasks'
|
11
|
+
|
12
|
+
RSpec::Core::RakeTask.new('spec:unit') do |spec|
|
13
|
+
spec.rspec_opts = %w(--format progress --format CI::Reporter::RSpec)
|
14
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
15
|
+
end
|
16
|
+
|
17
|
+
task 'spec:unit' => 'ci:setup:rspec'
|
18
|
+
task default: 'spec:unit'
|
19
|
+
|
20
|
+
require 'rubocop/rake_task'
|
21
|
+
desc 'Run RuboCop on the lib directory'
|
22
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
23
|
+
task.options = ['--no-color', '--out=rubocop-results.xml']
|
24
|
+
task.formatters = ['RuboCop::Formatter::CheckstyleFormatter']
|
25
|
+
task.requires = ['rubocop/formatter/checkstyle_formatter']
|
26
|
+
# don't abort rake on failure
|
27
|
+
task.fail_on_error = false
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'openstudio-workflow'
|
31
|
+
desc 'test extracting zip'
|
32
|
+
task :test_zip do
|
33
|
+
f = File.join(File.dirname(__FILE__), 'spec/files/example_models/the_project.zip')
|
34
|
+
puts "Trying to extract #{f}"
|
35
|
+
OpenStudio::Workflow.extract_archive(f, 'junk_out', true)
|
36
|
+
end
|
data/lib/openstudio-workflow.rb
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
######################################################################
|
2
|
-
# Copyright (c) 2008-2014, Alliance for Sustainable Energy.
|
3
|
-
# All rights reserved.
|
4
|
-
#
|
5
|
-
# This library is free software; you can redistribute it and/or
|
6
|
-
# modify it under the terms of the GNU Lesser General Public
|
7
|
-
# License as published by the Free Software Foundation; either
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This library is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# Lesser General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Lesser General Public
|
16
|
-
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
-
######################################################################
|
19
|
-
|
20
|
-
require 'fileutils'
|
21
|
-
require 'json'
|
22
|
-
require 'pathname'
|
23
|
-
|
24
|
-
require_relative 'openstudio/workflow/version'
|
25
|
-
require_relative 'openstudio/workflow/multi_delegator'
|
26
|
-
require_relative 'openstudio/workflow/run'
|
27
|
-
require_relative 'openstudio/workflow/job'
|
28
|
-
require_relative 'openstudio/workflow/time_logger'
|
29
|
-
require_relative 'openstudio/workflow/registry'
|
30
|
-
require_relative 'openstudio/workflow/util'
|
31
|
-
require 'openstudio'
|
32
|
-
require_relative 'openstudio/workflow_runner'
|
33
|
-
|
34
|
-
module OpenStudio
|
35
|
-
module Workflow
|
36
|
-
extend self
|
37
|
-
|
38
|
-
# Extract an archive to a specific location
|
39
|
-
#
|
40
|
-
# @param archive_filename [String] Path and name of the file to extract
|
41
|
-
# @param destination [String] Path to extract to
|
42
|
-
# @param overwrite [Boolean] If true, will overwrite any extracted file that may already exist
|
43
|
-
#
|
44
|
-
def extract_archive(archive_filename, destination, overwrite = true)
|
45
|
-
zf = OpenStudio::UnzipFile.new(archive_filename)
|
46
|
-
zf.extractAllFiles(destination)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
1
|
+
######################################################################
|
2
|
+
# Copyright (c) 2008-2014, Alliance for Sustainable Energy.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
######################################################################
|
19
|
+
|
20
|
+
require 'fileutils'
|
21
|
+
require 'json'
|
22
|
+
require 'pathname'
|
23
|
+
|
24
|
+
require_relative 'openstudio/workflow/version'
|
25
|
+
require_relative 'openstudio/workflow/multi_delegator'
|
26
|
+
require_relative 'openstudio/workflow/run'
|
27
|
+
require_relative 'openstudio/workflow/job'
|
28
|
+
require_relative 'openstudio/workflow/time_logger'
|
29
|
+
require_relative 'openstudio/workflow/registry'
|
30
|
+
require_relative 'openstudio/workflow/util'
|
31
|
+
require 'openstudio'
|
32
|
+
require_relative 'openstudio/workflow_runner'
|
33
|
+
|
34
|
+
module OpenStudio
|
35
|
+
module Workflow
|
36
|
+
extend self
|
37
|
+
|
38
|
+
# Extract an archive to a specific location
|
39
|
+
#
|
40
|
+
# @param archive_filename [String] Path and name of the file to extract
|
41
|
+
# @param destination [String] Path to extract to
|
42
|
+
# @param overwrite [Boolean] If true, will overwrite any extracted file that may already exist
|
43
|
+
#
|
44
|
+
def extract_archive(archive_filename, destination, overwrite = true)
|
45
|
+
zf = OpenStudio::UnzipFile.new(archive_filename)
|
46
|
+
zf.extractAllFiles(destination)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|