Class: Conductor::Worker::Events::TaskExecutionFailure

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

Overview

Published when task execution fails

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:, duration_ms:, cause:, is_retryable: true) ⇒ TaskExecutionFailure

Returns a new instance of TaskExecutionFailure.

Parameters:

  • task_type (String)

    Task definition name

  • task_id (String)

    Unique task identifier

  • worker_id (String)

    Unique worker identifier

  • workflow_instance_id (String)

    Workflow instance identifier

  • duration_ms (Float)

    Duration of execution in milliseconds

  • cause (Exception)

    The exception that caused the failure

  • is_retryable (Boolean) (defaults to: true)

    Whether the error is retryable (default: true)



166
167
168
169
170
171
172
173
174
175
# File 'lib/conductor/worker/events/task_runner_events.rb', line 166

def initialize(task_type:, task_id:, worker_id:, workflow_instance_id:,
               duration_ms:, cause:, is_retryable: true)
  super(task_type: task_type)
  @task_id = task_id
  @worker_id = worker_id
  @workflow_instance_id = workflow_instance_id
  @duration_ms = duration_ms
  @cause = cause
  @is_retryable = is_retryable
end

Instance Attribute Details

#causeException (readonly)

Returns The exception that caused the failure.

Returns:

  • (Exception)

    The exception that caused the failure



155
156
157
# File 'lib/conductor/worker/events/task_runner_events.rb', line 155

def cause
  @cause
end

#duration_msFloat (readonly)

Returns Duration of execution in milliseconds.

Returns:

  • (Float)

    Duration of execution in milliseconds



153
154
155
# File 'lib/conductor/worker/events/task_runner_events.rb', line 153

def duration_ms
  @duration_ms
end

#is_retryableBoolean (readonly)

Returns Whether the error is retryable.

Returns:

  • (Boolean)

    Whether the error is retryable



157
158
159
# File 'lib/conductor/worker/events/task_runner_events.rb', line 157

def is_retryable
  @is_retryable
end

#task_idString (readonly)

Returns Unique task identifier.

Returns:

  • (String)

    Unique task identifier



147
148
149
# File 'lib/conductor/worker/events/task_runner_events.rb', line 147

def task_id
  @task_id
end

#worker_idString (readonly)

Returns Unique worker identifier.

Returns:

  • (String)

    Unique worker identifier



149
150
151
# File 'lib/conductor/worker/events/task_runner_events.rb', line 149

def worker_id
  @worker_id
end

#workflow_instance_idString (readonly)

Returns Workflow instance identifier.

Returns:

  • (String)

    Workflow instance identifier



151
152
153
# File 'lib/conductor/worker/events/task_runner_events.rb', line 151

def workflow_instance_id
  @workflow_instance_id
end

Instance Method Details

#to_hObject



177
178
179
180
181
182
183
184
185
186
187
# File 'lib/conductor/worker/events/task_runner_events.rb', line 177

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