Class: OpenStudio::Workflow::OutputAdapter::Local
- Inherits:
-
OpenStudio::Workflow::OutputAdapters
- Object
- OpenStudio::Workflow::OutputAdapters
- OpenStudio::Workflow::OutputAdapter::Local
- Defined in:
- lib/openstudio/workflow/adapters/output/local.rb
Instance Attribute Summary
Attributes inherited from OpenStudio::Workflow::OutputAdapters
Instance Method Summary collapse
-
#communicate_complete ⇒ Object
Write to the filesystem that the process has completed.
-
#communicate_energyplus_stdout(_ = nil, _ = nil) ⇒ Object
Do nothing on EnergyPlus stdout.
-
#communicate_failure ⇒ Object
Write to the filesystem that the process has failed.
-
#communicate_measure_attributes(measure_attributes, _ = nil) ⇒ Object
Write the measure attributes to the filesystem.
-
#communicate_measure_result(_ = nil, _ = nil) ⇒ Object
Do nothing on Measure result.
-
#communicate_objective_function(objectives, _ = nil) ⇒ Object
Write the objective function results to the filesystem.
-
#communicate_results(directory, results) ⇒ Object
Write the results of the workflow to the filesystem.
-
#communicate_started ⇒ Object
Write to the filesystem that the process has started.
-
#communicate_transition(_ = nil, _ = nil, _ = nil) ⇒ Object
Do nothing on a state transition.
-
#initialize(options = {}) ⇒ Local
constructor
A new instance of Local.
Methods inherited from OpenStudio::Workflow::OutputAdapters
Constructor Details
#initialize(options = {}) ⇒ Local
Returns a new instance of Local.
27 28 29 30 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 27 def initialize( = {}) raise 'The required :output_directory option was not passed to the local output adapter' unless [:output_directory] super end |
Instance Method Details
#communicate_complete ⇒ Object
Write to the filesystem that the process has completed
40 41 42 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 40 def communicate_complete File.open("#{@options[:output_directory]}/finished.job", 'w') { |f| f << "Finished Workflow #{::Time.now}" } end |
#communicate_energyplus_stdout(_ = nil, _ = nil) ⇒ Object
Do nothing on EnergyPlus stdout
57 58 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 57 def communicate_energyplus_stdout(_ = nil, _ = nil) end |
#communicate_failure ⇒ Object
Write to the filesystem that the process has failed
46 47 48 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 46 def communicate_failure File.open("#{@options[:output_directory]}/failed.job", 'w') { |f| f << "Failed Workflow #{::Time.now}" } end |
#communicate_measure_attributes(measure_attributes, _ = nil) ⇒ Object
Write the measure attributes to the filesystem
67 68 69 70 71 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 67 def communicate_measure_attributes(measure_attributes, _ = nil) File.open("#{@options[:output_directory]}/measure_attributes.json", 'w') do |f| f << JSON.pretty_generate(measure_attributes) end end |
#communicate_measure_result(_ = nil, _ = nil) ⇒ Object
Do nothing on Measure result
62 63 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 62 def communicate_measure_result(_ = nil, _ = nil) end |
#communicate_objective_function(objectives, _ = nil) ⇒ Object
Write the objective function results to the filesystem
75 76 77 78 79 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 75 def communicate_objective_function(objectives, _ = nil) obj_fun_file = "#{@options[:output_directory]}/objectives.json" FileUtils.rm_f(obj_fun_file) if File.exist?(obj_fun_file) File.open(obj_fun_file, 'w') { |f| f << JSON.pretty_generate(objectives) } end |
#communicate_results(directory, results) ⇒ Object
Write the results of the workflow to the filesystem
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 83 def communicate_results(directory, results) zip_results(directory) if results.is_a? Hash # DLM: don't we want this in the results zip? # DLM: deprecate in favor of out.osw File.open("#{@options[:output_directory]}/data_point_out.json", 'w') { |f| f << JSON.pretty_generate(results) } else #puts "Unknown datapoint result type. Please handle #{results.class}" end end |
#communicate_started ⇒ Object
Write to the filesystem that the process has started
34 35 36 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 34 def communicate_started File.open("#{@options[:output_directory]}/started.job", 'w') { |f| f << "Started Workflow #{::Time.now}" } end |
#communicate_transition(_ = nil, _ = nil, _ = nil) ⇒ Object
Do nothing on a state transition
52 53 |
# File 'lib/openstudio/workflow/adapters/output/local.rb', line 52 def communicate_transition(_ = nil, _ = nil, _ = nil) end |