-
Notifications
You must be signed in to change notification settings - Fork 16.8k
fix: skip transiently missing serialized DAGs instead of bulk-failing tasks #62878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -769,19 +769,17 @@ def _executable_task_instances_to_queued(self, max_tis: int, session: Session) - | |
| serialized_dag = self.scheduler_dag_bag.get_dag_for_run( | ||
| dag_run=task_instance.dag_run, session=session | ||
| ) | ||
| # If the dag is missing, fail the task and continue to the next task. | ||
| # If the dag is transiently missing, skip scheduling it this iteration | ||
| # and try again next time instead of bulk-failing all scheduled tasks. | ||
| # See: https://github.com/apache/airflow/issues/62050 | ||
| if not serialized_dag: | ||
| self.log.error( | ||
| "DAG '%s' for task instance %s not found in serialized_dag table", | ||
| self.log.warning( | ||
| "DAG '%s' for task instance %s not found in serialized_dag table, " | ||
| "skipping scheduling for this iteration and will retry next time", | ||
| dag_id, | ||
| task_instance, | ||
| ) | ||
| session.execute( | ||
| update(TI) | ||
| .where(TI.dag_id == dag_id, TI.state == TaskInstanceState.SCHEDULED) | ||
| .values(state=TaskInstanceState.FAILED) | ||
| .execution_options(synchronize_session="fetch") | ||
| ) | ||
| starved_dags.add(dag_id) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a DAG is permanently deleted (not just transiently missing), tasks will stay SCHEDULED forever and this warning will fire every scheduler iteration. Would it be worth tracking consecutive misses per |
||
| continue | ||
|
|
||
| task_concurrency_limit: int | None = None | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a batch has multiple TIs for the same DAG, each one will hit
get_dag_for_runand log this warning individually before thestarved_dagsfilter kicks in on the next query iteration. Consider checkingif dag_id in starved_dags: continuebefore entering thehas_task_concurrency_limitsblock, both to avoid redundant DB lookups and to reduce log noise.