Class: Retab::ExperimentRun

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/experiment_runs/experiment_run.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  workflow: :workflow,
  trigger: :trigger,
  experiment_id: :experiment_id,
  block_id: :block_id,
  block_type: :block_type,
  n_consensus: :n_consensus,
  lifecycle: :lifecycle,
  timing: :timing,
  parent_run_id: :parent_run_id,
  definition_fingerprint: :definition_fingerprint,
  documents_fingerprint: :documents_fingerprint,
  score: :score,
  total_document_count: :total_document_count,
  completed_document_count: :completed_document_count,
  document_count: :document_count,
  error_count: :error_count
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ ExperimentRun

Returns a new instance of ExperimentRun.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/retab/experiment_runs/experiment_run.rb', line 47

def initialize(json)
  hash = self.class.normalize(json)
  @id = hash[:id]
  @workflow = hash[:workflow] ? Retab::WorkflowSnapshotRef.new(hash[:workflow]) : nil
  @trigger = hash[:trigger] ? Retab::ExperimentRunTrigger.new(hash[:trigger]) : nil
  @experiment_id = hash[:experiment_id]
  @block_id = hash[:block_id]
  @block_type = hash[:block_type]
  @n_consensus = hash[:n_consensus]
  @lifecycle = hash[:lifecycle] ? (case hash[:lifecycle][:status] when "cancelled" then Retab::CancelledWorkflowExperimentRun.new(hash[:lifecycle]) when "completed" then Retab::CompletedWorkflowExperimentRun.new(hash[:lifecycle]) when "error" then Retab::ErrorWorkflowExperimentRun.new(hash[:lifecycle]) when "pending" then Retab::PendingWorkflowExperimentRun.new(hash[:lifecycle]) when "queued" then Retab::QueuedWorkflowExperimentRun.new(hash[:lifecycle]) when "running" then Retab::RunningWorkflowExperimentRun.new(hash[:lifecycle]) else hash[:lifecycle] end) : nil
  @timing = hash[:timing] ? Retab::ExperimentRunTiming.new(hash[:timing]) : nil
  @parent_run_id = hash[:parent_run_id]
  @definition_fingerprint = hash[:definition_fingerprint]
  @documents_fingerprint = hash[:documents_fingerprint]
  @score = hash[:score]
  @total_document_count = hash[:total_document_count]
  @completed_document_count = hash[:completed_document_count]
  @document_count = hash[:document_count]
  @error_count = hash[:error_count]
end

Instance Attribute Details

#block_idObject

Returns the value of attribute block_id.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def block_id
  @block_id
end

#block_typeObject

Returns the value of attribute block_type.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def block_type
  @block_type
end

#completed_document_countObject

Returns the value of attribute completed_document_count.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def completed_document_count
  @completed_document_count
end

#definition_fingerprintObject

Returns the value of attribute definition_fingerprint.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def definition_fingerprint
  @definition_fingerprint
end

#document_countObject

Returns the value of attribute document_count.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def document_count
  @document_count
end

#documents_fingerprintObject

Returns the value of attribute documents_fingerprint.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def documents_fingerprint
  @documents_fingerprint
end

#error_countObject

Returns the value of attribute error_count.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def error_count
  @error_count
end

#experiment_idObject

Returns the value of attribute experiment_id.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def experiment_id
  @experiment_id
end

#idObject

Returns the value of attribute id.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def id
  @id
end

#lifecycleObject

Returns the value of attribute lifecycle.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def lifecycle
  @lifecycle
end

#n_consensusObject

Returns the value of attribute n_consensus.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def n_consensus
  @n_consensus
end

#parent_run_idObject

Returns the value of attribute parent_run_id.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def parent_run_id
  @parent_run_id
end

#scoreObject

Returns the value of attribute score.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def score
  @score
end

#timingObject

Returns the value of attribute timing.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def timing
  @timing
end

#total_document_countObject

Returns the value of attribute total_document_count.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def total_document_count
  @total_document_count
end

#triggerObject

Returns the value of attribute trigger.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def trigger
  @trigger
end

#workflowObject

Returns the value of attribute workflow.



28
29
30
# File 'lib/retab/experiment_runs/experiment_run.rb', line 28

def workflow
  @workflow
end