Class: Ace::Sim::Models::SimulationSession
- Inherits:
-
Object
- Object
- Ace::Sim::Models::SimulationSession
- Defined in:
- lib/ace/sim/models/simulation_session.rb
Instance Attribute Summary collapse
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#preset ⇒ Object
readonly
Returns the value of attribute preset.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
-
#repeat ⇒ Object
readonly
Returns the value of attribute repeat.
-
#run_id ⇒ Object
readonly
Returns the value of attribute run_id.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#step_bundles ⇒ Object
readonly
Returns the value of attribute step_bundles.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#synthesis_provider ⇒ Object
readonly
Returns the value of attribute synthesis_provider.
-
#synthesis_workflow ⇒ Object
readonly
Returns the value of attribute synthesis_workflow.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
-
#writeback ⇒ Object
readonly
Returns the value of attribute writeback.
Instance Method Summary collapse
- #bundle_path_for(step) ⇒ Object
- #dry_run? ⇒ Boolean
-
#initialize(preset:, source:, steps:, providers:, repeat:, dry_run:, writeback:, verbose: false, run_id: nil, step_bundles: {}, synthesis_workflow: nil, synthesis_provider: nil) ⇒ SimulationSession
constructor
A new instance of SimulationSession.
- #regenerate_run_id! ⇒ Object
- #synthesis_enabled? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(preset:, source:, steps:, providers:, repeat:, dry_run:, writeback:, verbose: false, run_id: nil, step_bundles: {}, synthesis_workflow: nil, synthesis_provider: nil) ⇒ SimulationSession
Returns a new instance of SimulationSession.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ace/sim/models/simulation_session.rb', line 10 def initialize(preset:, source:, steps:, providers:, repeat:, dry_run:, writeback:, verbose: false, run_id: nil, step_bundles: {}, synthesis_workflow: nil, synthesis_provider: nil) @preset = preset.to_s.strip @source = Array(source).map(&:to_s).map(&:strip).reject(&:empty?) @steps = Ace::Sim.normalize_list(steps) @providers = Ace::Sim.normalize_list(providers) @repeat = Integer(repeat) @dry_run = !!dry_run @writeback = !!writeback @verbose = !!verbose @step_bundles = stringify_step_bundles(step_bundles) @synthesis_workflow = synthesis_workflow.to_s.strip @synthesis_provider = synthesis_provider.to_s.strip @run_id = run_id || Ace::Sim.next_run_id validate! end |
Instance Attribute Details
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def dry_run @dry_run end |
#preset ⇒ Object (readonly)
Returns the value of attribute preset.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def preset @preset end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def providers @providers end |
#repeat ⇒ Object (readonly)
Returns the value of attribute repeat.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def repeat @repeat end |
#run_id ⇒ Object (readonly)
Returns the value of attribute run_id.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def run_id @run_id end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def source @source end |
#step_bundles ⇒ Object (readonly)
Returns the value of attribute step_bundles.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def step_bundles @step_bundles end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def steps @steps end |
#synthesis_provider ⇒ Object (readonly)
Returns the value of attribute synthesis_provider.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def synthesis_provider @synthesis_provider end |
#synthesis_workflow ⇒ Object (readonly)
Returns the value of attribute synthesis_workflow.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def synthesis_workflow @synthesis_workflow end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def verbose @verbose end |
#writeback ⇒ Object (readonly)
Returns the value of attribute writeback.
7 8 9 |
# File 'lib/ace/sim/models/simulation_session.rb', line 7 def writeback @writeback end |
Instance Method Details
#bundle_path_for(step) ⇒ Object
36 37 38 |
# File 'lib/ace/sim/models/simulation_session.rb', line 36 def bundle_path_for(step) step_bundles[step.to_s] end |
#dry_run? ⇒ Boolean
28 29 30 |
# File 'lib/ace/sim/models/simulation_session.rb', line 28 def dry_run? dry_run end |
#regenerate_run_id! ⇒ Object
32 33 34 |
# File 'lib/ace/sim/models/simulation_session.rb', line 32 def regenerate_run_id! @run_id = Ace::Sim.next_run_id end |
#synthesis_enabled? ⇒ Boolean
40 41 42 |
# File 'lib/ace/sim/models/simulation_session.rb', line 40 def synthesis_enabled? !synthesis_workflow.empty? end |
#to_h ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ace/sim/models/simulation_session.rb', line 44 def to_h { "run_id" => run_id, "preset" => preset, "source" => source, "steps" => steps, "providers" => providers, "repeat" => repeat, "dry_run" => dry_run, "writeback" => writeback, "synthesis_workflow" => synthesis_workflow, "synthesis_provider" => synthesis_provider } end |