Class: Conductor::Worker::Events::TaskUpdateFailure

Inherits:
TaskRunnerEvent show all
Defined in:
lib/conductor/worker/events/task_runner_events.rb

Overview

Published when task update fails after all retries This is a CRITICAL event - the task result is lost

Instance Attribute Summary collapse

Attributes inherited from TaskRunnerEvent

#task_type

Attributes inherited from ConductorEvent

#timestamp

Instance Method Summary collapse

Constructor Details

#initialize(task_type:, task_id:, worker_id:, workflow_instance_id:, cause:, retry_count:, task_result:, duration_ms: nil) ⇒ TaskUpdateFailure

Returns a new instance of TaskUpdateFailure.



216
217
218
219
220
221
222
223
224
225
226
# File 'lib/conductor/worker/events/task_runner_events.rb', line 216

def initialize(task_type:, task_id:, worker_id:, workflow_instance_id:,
               cause:, retry_count:, task_result:, duration_ms: nil)
  super(task_type: task_type)
  @task_id = task_id
  @worker_id = worker_id
  @workflow_instance_id = workflow_instance_id
  @cause = cause
  @retry_count = retry_count
  @task_result = task_result
  @duration_ms = duration_ms
end

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



213
214
215
# File 'lib/conductor/worker/events/task_runner_events.rb', line 213

def cause
  @cause
end

#duration_msObject (readonly)

Returns the value of attribute duration_ms.



213
214
215
# File 'lib/conductor/worker/events/task_runner_events.rb', line 213

def duration_ms
  @duration_ms
end

#retry_countObject (readonly)

Returns the value of attribute retry_count.



213
214
215
# File 'lib/conductor/worker/events/task_runner_events.rb', line 213

def retry_count
  @retry_count
end

#task_idObject (readonly)

Returns the value of attribute task_id.



213
214
215
# File 'lib/conductor/worker/events/task_runner_events.rb', line 213

def task_id
  @task_id
end

#task_resultObject (readonly)

Returns the value of attribute task_result.



213
214
215
# File 'lib/conductor/worker/events/task_runner_events.rb', line 213

def task_result
  @task_result
end

#worker_idObject (readonly)

Returns the value of attribute worker_id.



213
214
215
# File 'lib/conductor/worker/events/task_runner_events.rb', line 213

def worker_id
  @worker_id
end

#workflow_instance_idObject (readonly)

Returns the value of attribute workflow_instance_id.



213
214
215
# File 'lib/conductor/worker/events/task_runner_events.rb', line 213

def workflow_instance_id
  @workflow_instance_id
end

Instance Method Details

#to_hObject



228
229
230
231
232
233
234
235
# File 'lib/conductor/worker/events/task_runner_events.rb', line 228

def to_h
  super.merge(
    task_id: @task_id, worker_id: @worker_id,
    workflow_instance_id: @workflow_instance_id,
    cause: @cause.class.name, cause_message: @cause.message,
    retry_count: @retry_count, duration_ms: @duration_ms
  )
end