OscarLigthart commented on code in PR #59764:
URL: https://github.com/apache/airflow/pull/59764#discussion_r2913273893
##########
airflow-core/src/airflow/serialization/definitions/dag.py:
##########
@@ -1011,7 +1032,27 @@ def clear(
tuples that should not be cleared
:param exclude_run_ids: A set of ``run_id`` or (``run_id``)
"""
- from airflow.models.taskinstance import clear_task_instances
+ from airflow.models.taskinstance import (
+ _get_new_task_ids,
+ _update_dagrun_to_latest_version,
+ clear_task_instances,
+ )
+
+ if only_new:
+ if task_ids is not None:
+ raise ValueError("only_new and task_ids are mutually
exclusive")
+ if only_failed:
+ raise ValueError("only_new and only_failed are mutually
exclusive")
+ if only_running:
+ raise ValueError("only_new and only_running are mutually
exclusive")
+ if not run_id:
+ raise ValueError("only_new requires run_id to be specified")
+ task_ids = _get_new_task_ids(self.dag_id, run_id, session)
+
+ if dry_run:
+ return set(task_ids)
+ if task_ids:
+ _update_dagrun_to_latest_version(self.dag_id, run_id, session)
Review Comment:
It shouldn't right? This whole block only gets executed if `only_new=True`.
--
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]