Skip to content

Implement execution_timeout semantics for AirbyteTriggerSyncOperator in deferrable mode#64051

Draft
SameerMesiah97 wants to merge 1 commit intoapache:mainfrom
SameerMesiah97:64048-AirbyteTriggerSyncOperator-Deferrable-Timeout
Draft

Implement execution_timeout semantics for AirbyteTriggerSyncOperator in deferrable mode#64051
SameerMesiah97 wants to merge 1 commit intoapache:mainfrom
SameerMesiah97:64048-AirbyteTriggerSyncOperator-Deferrable-Timeout

Conversation

@SameerMesiah97
Copy link
Contributor

Description

This change enforces execution_timeout for AirbyteTriggerSyncOperator in deferrable mode.

Previously, when the operator deferred, execution_timeout was not enforced, allowing Airbyte jobs to continue running after the Airflow task had timed out.

The operator now computes an execution deadline before deferring, the trigger emits a timeout event when the deadline is exceeded, and the operator cancels the Airbyte job and fails the task when the event is received.

Rationale

In non-deferrable mode, execution_timeout is enforced by the scheduler, which terminates the task process and invokes on_kill() to cancel the external Airbyte job.

In deferrable mode, execution is handed off to a trigger running in the triggerer process, so there is no worker process to terminate. However, this does not change the expected task semantics. From a user perspective, execution_timeout is a hard task-level limit and should behave consistently regardless of execution mode.

Without explicit handling in the trigger/operator interaction, execution_timeout becomes a no-op in deferrable mode, leading to leaked Airbyte jobs and inconsistent behavior.

This is the same class of issue addressed in PR #61472 for DbtCloudRunJobOperator.

Notes

  • The existing timeout parameter only controls how long the operator waits for job completion and does not imply cancellation.
  • When both execution_timeout and timeout are set, the earlier deadline takes precedence.
  • Job cancellation on timeout is best-effort. Failures during cancellation are logged and do not mask the original timeout failure.
  • In execute_complete, generic AirflowException raises have been replaced with more appropriate, specific exception types.
  • Before/after behavior screenshots can be provided upon request.

Tests

  • Added a trigger-level test asserting a timeout event when the execution deadline is exceeded.
  • Added an operator-level test verifying job cancellation on execution timeout.
  • Added an operator-level test verifying error propagation when job cancellation fails.
  • Modified a trigger serialization test to ensure the optional execution_deadline field is always serialized.

Documentation

  • Updated the trigger docstring to document the new execution_deadline parameter.
  • Updated the operator docstring to clarify the behavior of timeout vs execution_timeout; added an entry for execution_timeout.

Backwards Compatibility

This change does not modify public APIs or method signatures.

Behavior is changed such that Airbyte jobs are now cancelled when execution_timeout is reached in deferrable mode. Previously, jobs could continue running after the task timed out.

Closes: #64048

@SameerMesiah97 SameerMesiah97 marked this pull request as draft March 21, 2026 22:22
@SameerMesiah97 SameerMesiah97 force-pushed the 64048-AirbyteTriggerSyncOperator-Deferrable-Timeout branch 8 times, most recently from c255d11 to 5951be9 Compare March 23, 2026 00:22
Restore execution_timeout semantics in deferrable mode by propagating
timeouts through the trigger and explicitly cancelling Airbyte jobs
when the task exceeds its execution deadline.

This preserves behavior parity with non-deferrable execution and avoids
leaking Airbyte jobs.

Add tests covering execution timeout handling in both the operator and
trigger, including successful cancellation and best-effort behavior when
job cancellation fails.
@SameerMesiah97 SameerMesiah97 force-pushed the 64048-AirbyteTriggerSyncOperator-Deferrable-Timeout branch from 5951be9 to 52ddbc1 Compare March 23, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AirbyteTriggerSyncOperator does not enforce execution_timeout semantics in Deferrable mode

1 participant