SameerMesiah97 opened a new pull request, #66449: URL: https://github.com/apache/airflow/pull/66449
**Description** This change refactors the deferrable execution path of `DbtCloudRunJobOperator` to align with the implementation introduced in PR #64051 following maintainer feedback. In deferrable mode, the operator now passes `execution_timeout` through `defer()`, and the trigger has been restructured to simplify polling and terminal state handling. Cancellation on timeout events has been updated to use best-effort semantics. **Rationale** This change brings the deferrable implementation of `DbtCloudRunJobOperator` in line with the pattern established in PR #64051 after maintainer feedback, ensuring consistency across deferrable operators. In deferrable mode, execution is handled by a trigger running in the triggerer process rather than a worker process. As a result, timeout and terminal state handling must be coordinated between the operator and trigger. This refactor simplifies the trigger control flow, removes redundant status checks, and standardizes how job state is evaluated across polling iterations, improving readability and maintainability. **Notes** * The same best-effort semantics are applied in `on_kill` for consistency; cancellation errors are logged and not re-raised. * Replaced `time.time()` with `time.monotonic()` for deadline calculations to ensure monotonic time semantics. **Tests** * Added an operator-level test verifying that cancellation failures during timeout handling do not mask the original timeout error (`execute_complete` still raises). * Added an operator-level test verifying that no cancellation is attempted when a timeout event is received without a `run_id`. * Added an operator-level test verifying that `on_kill` performs cancellation and confirms successful termination when possible. * Added an operator-level test verifying best-effort semantics in `on_kill`, ensuring cancellation and confirmation failures do not raise. * Adjusted existing trigger tests (including fixtures and supporting test setup) to accommodate the refactored polling structure and updated control flow. * Removed trigger test covering final status re-check logic, as this behavior is no longer part of the refactored polling implementation. * Existing tests have been updated and parameterized where appropriate. **Backwards Compatibility** This change does not modify public APIs or method signatures. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
