openstudio-workflow 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36393e28da7642fc75d1e780e913c86f43c46548
4
- data.tar.gz: a9474bab185e5f286258129e73a58c5718a95ffd
3
+ metadata.gz: 0ac6a1a269c8cf860bd9ed5e5e7b2e0f530a2e55
4
+ data.tar.gz: fec2ff61cf6032460af81428d03614871a987bcb
5
5
  SHA512:
6
- metadata.gz: a4079a380d92cfff3fa7fd60454babbb768517ec7ecb182d27b29af37508629bb668db2fce62aa3127121bc9d9e0ee02966c1eb36262ae9f95e340ce413b95d4
7
- data.tar.gz: 36153a1892dd12bfb4d0dca47c32ca8a7f6a6bd0770a367d317c98ed9a8d82e3ec7edf1f15c429f69a319dca858d89db3f2a82cf9b9d8cc45f93b8a80dd5828c
6
+ metadata.gz: a51e1394e0447d54ec727a23eb29ff2f47b3449d2e5b12ca4139920feb0695d587edec4201b6813b919de4a20a818190c015525607e8c313d0f93d29bdc13a59
7
+ data.tar.gz: 160979c7c35fc78bfd390c8e8bf1a5d63ec856008356823b1691c568b70abe4bbd608f431932e6be53cd488207f58f7d61349206cf6ec9881f7a34ea38892eda
@@ -84,9 +84,11 @@ module OpenStudio
84
84
  zip_results(directory)
85
85
 
86
86
  if results.is_a? Hash
87
+ # DLM: don't we want this in the results zip?
88
+ # DLM: deprecate in favor of out.osw
87
89
  File.open("#{@options[:output_directory]}/data_point_out.json", 'w') { |f| f << JSON.pretty_generate(results) }
88
90
  else
89
- puts "Unknown datapoint result type. Please handle #{results.class}"
91
+ #puts "Unknown datapoint result type. Please handle #{results.class}"
90
92
  end
91
93
  end
92
94
  end
@@ -28,6 +28,15 @@ class RunEnergyPlus < OpenStudio::Workflow::Job
28
28
 
29
29
  def perform
30
30
  @logger.debug "Calling #{__method__} in the #{self.class} class"
31
+
32
+ # skip if halted
33
+ begin
34
+ # method added in 2.1.2
35
+ halted = @registry[:runner].halted
36
+ @logger.info 'Workflow halted, skipping the EnergyPlus simulation'
37
+ return nil if halted
38
+ rescue NameError
39
+ end
31
40
 
32
41
  # Checks and configuration
33
42
  raise 'No run_dir specified in the registry' unless @registry[:run_dir]
@@ -29,6 +29,8 @@ class RunEnergyPlusMeasures < OpenStudio::Workflow::Job
29
29
 
30
30
  def perform
31
31
  @logger.debug "Calling #{__method__} in the #{self.class} class"
32
+
33
+ # halted workflow is handled in apply_measures
32
34
 
33
35
  # Ensure output_attributes is initialized in the registry
34
36
  @registry.register(:output_attributes) { {} } unless @registry[:output_attributes]
@@ -36,6 +36,8 @@ class RunInitialization < OpenStudio::Workflow::Job
36
36
  # DLM: why are there multiple loggers running around? there is one in the registry can we just use that?
37
37
  @logger.info "Calling #{__method__} in the #{self.class} class"
38
38
 
39
+ # do not skip initialization if halted
40
+
39
41
  # Communicate that the workflow has been started
40
42
  @logger.debug 'Registering that the workflow has started with the adapter'
41
43
  @output_adapter.communicate_started
@@ -31,6 +31,8 @@ class RunOpenStudioMeasures < OpenStudio::Workflow::Job
31
31
  def perform
32
32
  @logger.debug "Calling #{__method__} in the #{self.class} class"
33
33
 
34
+ # halted workflow is handled in apply_measures
35
+
34
36
  # set weather file
35
37
  if @registry[:wf] && @registry[:model]
36
38
  epwFile = OpenStudio::EpwFile.load(@registry[:wf])
@@ -34,6 +34,8 @@ class RunPostprocess < OpenStudio::Workflow::Job
34
34
  def perform
35
35
  @logger.debug "Calling #{__method__} in the #{self.class} class"
36
36
 
37
+ # do not skip post_process if halted
38
+
37
39
  @logger.info 'Gathering reports'
38
40
  gather_reports(@registry[:run_dir], @registry[:root_dir], @registry[:workflow_json], @logger)
39
41
  @logger.info 'Finished gathering reports'
@@ -30,6 +30,8 @@ class RunPreprocess < OpenStudio::Workflow::Job
30
30
 
31
31
  def perform
32
32
  @logger.debug "Calling #{__method__} in the #{self.class} class"
33
+
34
+ # halted workflow is handled in apply_measures
33
35
 
34
36
  # Ensure that the directory is created (but it should already be at this point)
35
37
  FileUtils.mkdir_p(@registry[:run_dir])
@@ -40,6 +40,8 @@ class RunReportingMeasures < OpenStudio::Workflow::Job
40
40
  @logger.debug "Calling #{__method__} in the #{self.class} class"
41
41
  @logger.debug 'RunPostProcess Retrieving datapoint and problem'
42
42
 
43
+ # halted workflow is handled in apply_measures
44
+
43
45
  # Ensure output_attributes is initialized in the registry
44
46
  @registry.register(:output_attributes) { {} } unless @registry[:output_attributes]
45
47
 
@@ -29,6 +29,15 @@ class RunTranslation < OpenStudio::Workflow::Job
29
29
  def perform
30
30
  @logger.debug "Calling #{__method__} in the #{self.class} class"
31
31
 
32
+ # skip if halted
33
+ begin
34
+ # method added in 2.1.2
35
+ halted = @registry[:runner].halted
36
+ @logger.info 'Workflow halted, skipping EnergyPlus translation'
37
+ return nil if halted
38
+ rescue NameError
39
+ end
40
+
32
41
  # Ensure that the run directory is created
33
42
  FileUtils.mkdir_p(@registry[:run_dir])
34
43
 
@@ -220,7 +220,10 @@ module OpenStudio
220
220
  if @current_state == :errored
221
221
  @registry[:workflow_json].setCompletedStatus('Fail') if @registry[:workflow_json]
222
222
  else
223
- @registry[:workflow_json].setCompletedStatus('Success')
223
+ # completed status will already be set if workflow was halted
224
+ if @registry[:workflow_json].completedStatus.empty?
225
+ @registry[:workflow_json].setCompletedStatus('Success')
226
+ end
224
227
  end
225
228
 
226
229
  # save all files before calling output adapter
@@ -22,6 +22,7 @@ module OpenStudio
22
22
  registry[:time_logger].start "#{measure_type.valueName}:apply_measures" if registry[:time_logger]
23
23
 
24
24
  logger = registry[:logger]
25
+ runner = registry[:runner]
25
26
  workflow_json = registry[:workflow_json]
26
27
 
27
28
  workflow_steps = workflow_json.workflowSteps
@@ -62,9 +63,17 @@ module OpenStudio
62
63
  workflow_json.incrementStep
63
64
  end
64
65
 
66
+ # check if simulation has been halted
67
+ halted = false
68
+ begin
69
+ # method added in 2.1.2
70
+ halted = runner.halted
71
+ rescue NameError
72
+ end
73
+
65
74
  # DLM: why is output_adapter in options instead of registry?
66
75
  options[:output_adapter].communicate_transition("Applying #{class_name}", :measure) if options[:output_adapter]
67
- apply_measure(registry, step, options)
76
+ apply_measure(registry, step, options, energyplus_output_requests, halted)
68
77
  options[:output_adapter].communicate_transition("Applied #{class_name}", :measure) if options[:output_adapter]
69
78
  end
70
79
 
@@ -224,10 +233,11 @@ module OpenStudio
224
233
  # step[:measure_dir_name], e.g. ['measures', '../../measures']
225
234
  # @option options [Object] :time_logger Special logger used to debug performance issues
226
235
  # @param [Boolean] energyplus_output_requests If true then the energyPlusOutputRequests is called instead of the run method
236
+ # @param [Boolean] halted True if the workflow has been halted and all measures should be skipped
227
237
  # @return [Hash, String] Returns two objects. The first is the (potentially) updated output_attributes hash, and
228
238
  # the second is the (potentially) updated current_weather_filepath
229
239
  #
230
- def apply_measure(registry, step, options = {}, energyplus_output_requests = false)
240
+ def apply_measure(registry, step, options = {}, energyplus_output_requests = false, halted = false)
231
241
 
232
242
  logger = registry[:logger]
233
243
  runner = registry[:runner]
@@ -404,7 +414,7 @@ module OpenStudio
404
414
  raise log_message
405
415
  end
406
416
 
407
- if skip_measure
417
+ if skip_measure || halted
408
418
  if !energyplus_output_requests
409
419
  # just increment
410
420
  logger.debug "Skipping measure '#{measure_dir_name}'"
@@ -527,11 +537,8 @@ module OpenStudio
527
537
 
528
538
  # DLM: this section creates the measure_attributes.json file which should be deprecated
529
539
  begin
530
- # DLM: which name do we want?
531
- measure_name = class_name
532
- #measure_name = measure_dir_name
533
-
534
- # DLM: do measure results from sequential measures with the same name clobber each other?
540
+ measure_name = step.name.is_initialized ? step.name.get : class_name
541
+
535
542
  output_attributes[measure_name.to_sym] = {} if output_attributes[measure_name.to_sym].nil?
536
543
 
537
544
  result.stepValues.each do |step_value|
@@ -19,6 +19,6 @@
19
19
 
20
20
  module OpenStudio
21
21
  module Workflow
22
- VERSION = '1.2.2'.freeze # Suffixes must have periods (not dashes)
22
+ VERSION = '1.3.0'.freeze # Suffixes must have periods (not dashes)
23
23
  end
24
24
  end
@@ -153,11 +153,19 @@ class WorkflowStep_Shim
153
153
 
154
154
  attr_reader :step
155
155
 
156
+ def name
157
+ if @step[:name]
158
+ Optional_Shim.new(@step[:name])
159
+ else
160
+ Optional_Shim.new(nil)
161
+ end
162
+ end
163
+
156
164
  def result
157
165
  if @step[:result]
158
166
  Optional_Shim.new(WorkflowStepResult_Shim.new(@step[:result]))
159
167
  else
160
- Optional_Shim.new
168
+ Optional_Shim.new(nil)
161
169
  end
162
170
  end
163
171
 
@@ -410,6 +418,14 @@ class WorkflowJSON_Shim
410
418
  result
411
419
  end
412
420
 
421
+ def completedStatus
422
+ if @workflow[:completed_status]
423
+ Optional_Shim.new(@workflow[:completed_status])
424
+ else
425
+ Optional_Shim.new(nil)
426
+ end
427
+ end
428
+
413
429
  def setCompletedStatus(status)
414
430
  @workflow[:completed_status] = status
415
431
  @workflow[:completed_at] = timeString
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Long
@@ -9,34 +9,34 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-17 00:00:00.000000000 Z
12
+ date: 2017-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.6'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.6'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: json-schema
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  description: Run OpenStudio based measures and simulations using EnergyPlus
@@ -47,10 +47,6 @@ executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
- - CHANGELOG.md
51
- - README.md
52
- - Rakefile
53
- - lib/openstudio-workflow.rb
54
50
  - lib/openstudio/workflow/adapters/input/local.rb
55
51
  - lib/openstudio/workflow/adapters/output/local.rb
56
52
  - lib/openstudio/workflow/adapters/output/socket.rb
@@ -70,16 +66,20 @@ files:
70
66
  - lib/openstudio/workflow/registry.rb
71
67
  - lib/openstudio/workflow/run.rb
72
68
  - lib/openstudio/workflow/time_logger.rb
73
- - lib/openstudio/workflow/util.rb
74
69
  - lib/openstudio/workflow/util/energyplus.rb
75
70
  - lib/openstudio/workflow/util/io.rb
76
71
  - lib/openstudio/workflow/util/measure.rb
77
72
  - lib/openstudio/workflow/util/model.rb
78
73
  - lib/openstudio/workflow/util/post_process.rb
79
74
  - lib/openstudio/workflow/util/weather_file.rb
75
+ - lib/openstudio/workflow/util.rb
80
76
  - lib/openstudio/workflow/version.rb
81
77
  - lib/openstudio/workflow_json.rb
82
78
  - lib/openstudio/workflow_runner.rb
79
+ - lib/openstudio-workflow.rb
80
+ - README.md
81
+ - CHANGELOG.md
82
+ - Rakefile
83
83
  homepage: https://github.com/NREL/OpenStudio-workflow-gem
84
84
  licenses:
85
85
  - LGPL
@@ -90,17 +90,17 @@ require_paths:
90
90
  - lib
91
91
  required_ruby_version: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - '>='
94
94
  - !ruby/object:Gem::Version
95
95
  version: '2.0'
96
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - ">="
98
+ - - '>='
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.6.10
103
+ rubygems_version: 2.0.14.1
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: OpenStudio Workflow Manager