Class: Retab::ExperimentResult
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::ExperimentResult
- Defined in:
- lib/retab/experiment_run_results/experiment_result.rb
Constant Summary collapse
- HASH_ATTRS =
{ id: :id, run_id: :run_id, experiment_id: :experiment_id, document_id: :document_id, lifecycle: :lifecycle, timing: :timing, block_type: :block_type, handle_inputs: :handle_inputs, artifact: :artifact, attempt: :attempt, is_placeholder: :is_placeholder }.freeze
Instance Attribute Summary collapse
-
#artifact ⇒ Object
Returns the value of attribute artifact.
-
#attempt ⇒ Object
Returns the value of attribute attempt.
-
#block_type ⇒ Object
Returns the value of attribute block_type.
-
#document_id ⇒ Object
Returns the value of attribute document_id.
-
#experiment_id ⇒ Object
Returns the value of attribute experiment_id.
-
#handle_inputs ⇒ Object
Returns the value of attribute handle_inputs.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_placeholder ⇒ Object
Returns the value of attribute is_placeholder.
-
#lifecycle ⇒ Object
Returns the value of attribute lifecycle.
-
#run_id ⇒ Object
Returns the value of attribute run_id.
-
#timing ⇒ Object
Returns the value of attribute timing.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ ExperimentResult
constructor
A new instance of ExperimentResult.
Methods inherited from Types::BaseModel
#inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ ExperimentResult
Returns a new instance of ExperimentResult.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 35 def initialize(json) hash = self.class.normalize(json) @id = hash[:id] @run_id = hash[:run_id] @experiment_id = hash[:experiment_id] @document_id = hash[:document_id] @lifecycle = hash[:lifecycle] ? (case hash[:lifecycle][:status] when "cancelled" then Retab::CancelledWorkflowExperimentResult.new(hash[:lifecycle]) when "completed" then Retab::CompletedWorkflowExperimentResult.new(hash[:lifecycle]) when "error" then Retab::ErrorWorkflowExperimentResult.new(hash[:lifecycle]) when "pending" then Retab::PendingWorkflowExperimentResult.new(hash[:lifecycle]) when "queued" then Retab::QueuedWorkflowExperimentResult.new(hash[:lifecycle]) when "running" then Retab::RunningWorkflowExperimentResult.new(hash[:lifecycle]) else hash[:lifecycle] end) : nil @timing = hash[:timing] ? Retab::ExperimentResultTiming.new(hash[:timing]) : nil @block_type = hash[:block_type] @handle_inputs = hash[:handle_inputs] || {} @artifact = hash[:artifact] ? Retab::StepArtifactRef.new(hash[:artifact]) : nil @attempt = hash[:attempt] @is_placeholder = hash[:is_placeholder] end |
Instance Attribute Details
#artifact ⇒ Object
Returns the value of attribute artifact.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def artifact @artifact end |
#attempt ⇒ Object
Returns the value of attribute attempt.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def attempt @attempt end |
#block_type ⇒ Object
Returns the value of attribute block_type.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def block_type @block_type end |
#document_id ⇒ Object
Returns the value of attribute document_id.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def document_id @document_id end |
#experiment_id ⇒ Object
Returns the value of attribute experiment_id.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def experiment_id @experiment_id end |
#handle_inputs ⇒ Object
Returns the value of attribute handle_inputs.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def handle_inputs @handle_inputs end |
#id ⇒ Object
Returns the value of attribute id.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def id @id end |
#is_placeholder ⇒ Object
Returns the value of attribute is_placeholder.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def is_placeholder @is_placeholder end |
#lifecycle ⇒ Object
Returns the value of attribute lifecycle.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def lifecycle @lifecycle end |
#run_id ⇒ Object
Returns the value of attribute run_id.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def run_id @run_id end |
#timing ⇒ Object
Returns the value of attribute timing.
22 23 24 |
# File 'lib/retab/experiment_run_results/experiment_result.rb', line 22 def timing @timing end |