pierrejeambrun commented on code in PR #67900:
URL: https://github.com/apache/airflow/pull/67900#discussion_r3506529986
##########
airflow-core/src/airflow/models/backfill.py:
##########
@@ -690,24 +694,63 @@ def _create_backfill(
raise RuntimeError(f"No runs to create for Dag {dag_id}")
first_info = dagrun_info_list[0]
- if first_info.partition_key:
- _create_runs_partitioned(
- br=br,
- dag=dag,
- dagrun_info_list=dagrun_info_list,
- session=session,
- )
- else:
- _create_runs_non_partitioned(
- br=br,
- dag=dag,
- dagrun_info_list=dagrun_info_list,
- run_on_latest_version=run_on_latest_version,
- session=session,
- )
+ try:
+ if first_info.partition_key:
+ _create_runs_partitioned(
+ br=br,
+ dag=dag,
+ dagrun_info_list=dagrun_info_list,
+ session=session,
+ )
+ else:
+ _create_runs_non_partitioned(
+ br=br,
+ dag=dag,
+ dagrun_info_list=dagrun_info_list,
+ run_on_latest_version=run_on_latest_version,
+ session=session,
+ )
+ except OperationalError as e:
+ if is_lock_not_available_error(e):
+ # Lock error: clean up the orphan so the user can retry. The
+ # helper is best-effort; if it fails the original error still
+ # surfaces and the route returns 503.
+ _cleanup_partial_backfill(br, session)
+ raise
return br
+def _cleanup_partial_backfill(br: Backfill, session: Session) -> None:
Review Comment:
`br` for backfill?
--
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]