Skip to main content

Handling Failures

The processors in a pipeline run sequentially, and when one of them fails or encounters an error, by default the process halts.

The on_failure processor can be used to specify a list of processors to run immediately after a processor fails. However, Director keeps running the pipeline's remaining processors even if the on_failure field is blank.

Recovery

To ignore a failure and keep running the remaining processors in the pipeline, ignore_failure must be set to true.

- rename:
field: provider
target_field: cloud.provider
ignore_failure: true

Continuation

To configure a processor so that in the event of a failure another processor runs, the on_failure parameter can be used.

- rename:
field: foo
target_field: bar
on_failure: [
- set:
field: error.message
value: "Field 'foo' could not be renamed as 'bar'"
override: false

Nesting

For cascading errors, multiple on_failure processors can be nested.

- rename:
field: foo
target_field: bar
on_failure:
- set:
field: error.message
value: "Field 'foo' could not be renamed as 'bar'"
override: false
on_failure:
- set:
field: error.message.cascade
value: "Multiple errors encountered"
override: true

Pipelines

The on_failure can also be specified for the pipeline. When a processor fails, in the absence of a processor-level on_failure setting, Director uses the pipeline-level setting as a fallback. However, in that case it does not attempt to run the remaining processors.

on_failure:
- set:
field: _index
value: failed-{{{ _ingest.on_failure_processor_tag }}}
message: "Processor failed"

Metadata

More information may be available in the metadata fields on_failure_message, on_failure_processor_type, on_failure_processor_tag, and on_failure_pipeline which can only be accessed from within an on_failure block.

on_failure:
- set:
field: error_info
value: "{{ _ingest.on_failure_processor_type }} in {{ _ingest.on_failure_pipeline }} failed; error message: {{ _ingest.on_failure_message }}"