Module: OpenStudio::Workflow

Extended by:
Workflow
Included in:
Workflow
Defined in:
lib/openstudio-workflow.rb,
lib/openstudio/workflow/run.rb,
lib/openstudio/workflow/adapter.rb,
lib/openstudio/workflow/version.rb,
lib/openstudio/workflow/adapters/local.rb,
lib/openstudio/workflow/adapters/mongo.rb,
lib/openstudio/workflow/jobs/lib/apply_measures.rb

Defined Under Namespace

Modules: Adapters, ApplyMeasures Classes: Adapter, Run

Constant Summary collapse

VERSION =
'0.0.2'

Instance Method Summary collapse

Instance Method Details

#load(adapter_name, run_directory, options = {}) ⇒ Object

Create a new workflow instance using the defined adapter and UUID



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/openstudio-workflow.rb', line 63

def load(adapter_name, run_directory, options = {})
  defaults = { adapter_options: {} }
  options = defaults.merge(options)

  # Convert various paths to absolute paths
  if options[:adapter_options] && options[:adapter_options][:mongoid_path] &&
      (Pathname.new options[:adapter_options][:mongoid_path]).absolute? == false
    options[:adapter_options][:mongoid_path] = File.expand_path options[:adapter_options][:mongoid_path]
  end
  if options[:analysis_root_path] &&
      (Pathname.new options[:analysis_root_path]).absolute? == false
    options[:analysis_root_path] = File.expand_path options[:analysis_root_path]
  end
  unless (Pathname.new run_directory).absolute?
    # relative to wherever you are running the script
    run_directory = File.expand_path run_directory
  end
  adapter = load_adapter adapter_name, options[:adapter_options]
  run_klass = OpenStudio::Workflow::Run.new(adapter, run_directory, options)
  # return the run class
  run_klass
end