Class: Rafflesia::JobData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/foundry/job_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  active_job_id: :active_job_id,
  attempt: :attempt,
  canceled_at: :canceled_at,
  cancelled_at: :cancelled_at,
  completed_at: :completed_at,
  created_at: :created_at,
  error: :error,
  events: :events,
  idempotency_key: :idempotency_key,
  idempotency_reused: :idempotency_reused,
  input_hash: :input_hash,
  is_terminal: :is_terminal,
  job_id: :job_id,
  last_error: :last_error,
  max_retries: :max_retries,
  message: :message,
  operation: :operation,
  progress: :progress,
  record_object: :record_object,
  result: :result,
  result_inline_bytes: :result_inline_bytes,
  result_object: :result_object,
  started_at: :started_at,
  status: :status,
  timed_out_at: :timed_out_at,
  timeout_ms: :timeout_ms,
  updated_at: :updated_at,
  version: :version,
  worker_id: :worker_id,
  worker_last_seen_at: :worker_last_seen_at,
  worker_version: :worker_version
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ JobData

Returns a new instance of JobData.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/rafflesia/foundry/job_data.rb', line 75

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @active_job_id = hash[:active_job_id]
  @attempt = hash[:attempt]
  @canceled_at = hash[:canceled_at]
  @cancelled_at = hash[:cancelled_at]
  @completed_at = hash[:completed_at]
  @created_at = hash[:created_at]
  @error = hash[:error] ? Rafflesia::ApiErrorBody.new(hash[:error]) : nil
  @events = (hash[:events] || []).map { |item| item ? Rafflesia::JobEvent.new(item) : nil }
  @idempotency_key = hash[:idempotency_key]
  @idempotency_reused = hash[:idempotency_reused]
  @input_hash = hash[:input_hash]
  @is_terminal = hash[:is_terminal]
  @job_id = hash[:job_id]
  @last_error = hash[:last_error] ? Rafflesia::ApiErrorBody.new(hash[:last_error]) : nil
  @max_retries = hash[:max_retries]
  @message = hash[:message]
  @operation = hash[:operation]
  @progress = hash[:progress] ? Rafflesia::JobProgress.new(hash[:progress]) : nil
  @record_object = hash[:record_object] ? Rafflesia::ObjectRef.new(hash[:record_object]) : nil
  @result = hash[:result]
  @result_inline_bytes = hash[:result_inline_bytes]
  @result_object = hash[:result_object] ? Rafflesia::ObjectRef.new(hash[:result_object]) : nil
  @started_at = hash[:started_at]
  @status = hash[:status]
  @timed_out_at = hash[:timed_out_at]
  @timeout_ms = hash[:timeout_ms]
  @updated_at = hash[:updated_at]
  @version = hash[:version]
  @worker_id = hash[:worker_id]
  @worker_last_seen_at = hash[:worker_last_seen_at]
  @worker_version = hash[:worker_version]
end

Instance Attribute Details

#active_job_idObject

Returns the value of attribute active_job_id.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def active_job_id
  @active_job_id
end

#attemptObject

Returns the value of attribute attempt.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def attempt
  @attempt
end

#canceled_atObject

Returns the value of attribute canceled_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def canceled_at
  @canceled_at
end

#cancelled_atObject

Returns the value of attribute cancelled_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def cancelled_at
  @cancelled_at
end

#completed_atObject

Returns the value of attribute completed_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def completed_at
  @completed_at
end

#created_atObject

Returns the value of attribute created_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def created_at
  @created_at
end

#errorObject

Returns the value of attribute error.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def error
  @error
end

#eventsObject

Returns the value of attribute events.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def events
  @events
end

#idempotency_keyObject

Returns the value of attribute idempotency_key.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def idempotency_key
  @idempotency_key
end

#idempotency_reusedObject

Returns the value of attribute idempotency_reused.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def idempotency_reused
  @idempotency_reused
end

#input_hashObject

Returns the value of attribute input_hash.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def input_hash
  @input_hash
end

#is_terminalObject

Returns the value of attribute is_terminal.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def is_terminal
  @is_terminal
end

#job_idObject

Returns the value of attribute job_id.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def job_id
  @job_id
end

#last_errorObject

Returns the value of attribute last_error.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def last_error
  @last_error
end

#max_retriesObject

Returns the value of attribute max_retries.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def max_retries
  @max_retries
end

#messageObject

Returns the value of attribute message.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def message
  @message
end

#operationObject

Returns the value of attribute operation.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def operation
  @operation
end

#progressObject

Returns the value of attribute progress.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def progress
  @progress
end

#record_objectObject

Returns the value of attribute record_object.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def record_object
  @record_object
end

#resultObject

Returns the value of attribute result.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def result
  @result
end

#result_inline_bytesObject

Returns the value of attribute result_inline_bytes.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def result_inline_bytes
  @result_inline_bytes
end

#result_objectObject

Returns the value of attribute result_object.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def result_object
  @result_object
end

#started_atObject

Returns the value of attribute started_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def started_at
  @started_at
end

#statusObject

Returns the value of attribute status.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def status
  @status
end

#timed_out_atObject

Returns the value of attribute timed_out_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def timed_out_at
  @timed_out_at
end

#timeout_msObject

Returns the value of attribute timeout_ms.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def timeout_ms
  @timeout_ms
end

#updated_atObject

Returns the value of attribute updated_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def updated_at
  @updated_at
end

#versionObject

Returns the value of attribute version.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def version
  @version
end

#worker_idObject

Returns the value of attribute worker_id.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def worker_id
  @worker_id
end

#worker_last_seen_atObject

Returns the value of attribute worker_last_seen_at.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def worker_last_seen_at
  @worker_last_seen_at
end

#worker_versionObject

Returns the value of attribute worker_version.



42
43
44
# File 'lib/rafflesia/foundry/job_data.rb', line 42

def worker_version
  @worker_version
end