pierrejeambrun commented on code in PR #56346:
URL: https://github.com/apache/airflow/pull/56346#discussion_r2426858253
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py:
##########
@@ -737,17 +737,15 @@ def post_clear_task_instances(
body.end_date = None
task_ids = body.task_ids
- if task_ids is not None:
- task_id = [task[0] if isinstance(task, tuple) else task for task in
task_ids]
- dag = dag.partial_subset(
+ if task_ids is not None and (upstream or downstream):
+ task_id = set([task[0] if isinstance(task, tuple) else task for task
in task_ids])
Review Comment:
We should find another name for `task_id` that's confusing.
##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -2981,6 +2982,8 @@ def _deepcopy_task(t) -> SerializedOperator:
return copy.deepcopy(t, memo)
# Compiling the unique list of tasks that made the cut
+ if exclude_original:
+ matched_tasks = []
Review Comment:
Why is that needed?
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py:
##########
@@ -737,17 +737,15 @@ def post_clear_task_instances(
body.end_date = None
task_ids = body.task_ids
- if task_ids is not None:
- task_id = [task[0] if isinstance(task, tuple) else task for task in
task_ids]
- dag = dag.partial_subset(
+ if task_ids is not None and (upstream or downstream):
+ task_id = set([task[0] if isinstance(task, tuple) else task for task
in task_ids])
+ relatives = dag.partial_subset(
task_ids=task_id,
include_downstream=downstream,
include_upstream=upstream,
+ exclude_original=True,
)
-
- if len(dag.task_dict) > 1:
- # If we had upstream/downstream etc then also include those!
- task_ids.extend(tid for tid in dag.task_dict if tid != task_id)
+ task_ids.extend(relatives.task_dict.keys())
Review Comment:
We still probably don't want to add duplicate `tid`
--
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]