1fanwang opened a new pull request, #68952:
URL: https://github.com/apache/airflow/pull/68952

   ## Why
   
   `ResumableJobMixin` is `execute()`-coupled: `execute_resumable()` invokes 
the operator's
   `submit_job` / `poll_until_complete` / … methods, so only operators whose 
`execute()` itself does
   the submit-and-poll can use it. Operators whose wait lives elsewhere can't — 
on Airflow 3,
   `TriggerDagRunOperator.execute()` raises `DagRunTriggerException` and the 
**task runner** does the
   submit + poll, so there is no mixin instance to call and the 
persist-and-reconnect logic ends up
   re-implemented by hand (see #68936).
   
   ## What
   
   Extract the mixin's core — persist the external id, then make the active / 
succeeded / terminal
   reconnect decision — into a standalone, instance-free 
`resume_or_submit(...)`. `execute_resumable()`
   becomes a thin wrapper that binds the operator's six methods to it.
   
   This makes AIP-103 durability a reusable primitive: the same core can be 
driven from the task
   runner (a stacked PR refactors #68936's hand-rolled logic onto it) and, 
later, from the triggerer —
   instead of duplicating the reconnect logic at each integration point.
   
   ## Tests
   
   The mixin's full existing suite passes unchanged — submit/poll, 
persist-before-poll, the three
   retry states, metrics, tracing span attributes, and logging. That unchanged 
suite is the
   behaviour-preservation proof. The shared core is additionally exercised 
end-to-end by the stacked
   `TriggerDagRunOperator` PR's live crash-safety reproduction.
   
   ## Risk
   
   Pure refactor with no behaviour change. The mixin's public surface and all 
six override methods are
   untouched; `resume_or_submit` carries the same metrics, spans, and log lines 
as before.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [ ] Yes (please specify the tool below)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


-- 
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]

Reply via email to