uranusjr commented on code in PR #39259:
URL: https://github.com/apache/airflow/pull/39259#discussion_r1580432816
##########
airflow/models/taskinstance.py:
##########
@@ -1003,25 +1009,40 @@ def _refresh_from_task(
task_instance_mutation_hook(task_instance)
+@internal_api_call
+@provide_session
def _record_task_map_for_downstreams(
- *, task_instance: TaskInstance | TaskInstancePydantic, task: Operator,
value: Any, session: Session
+ *,
+ task_instance: TaskInstance | TaskInstancePydantic,
+ task: Operator,
+ dag: DAG,
+ value: Any,
+ session: Session,
) -> None:
"""
Record the task map for downstream tasks.
:param task_instance: the task instance
:param task: The task object
+ :param dag: the dag associated with the task
:param value: The value
:param session: SQLAlchemy ORM Session
:meta private:
"""
+ # when taking task over RPC, we need to add the dag back
+ if isinstance(task, MappedOperator):
+ if not task.dag:
+ task.dag = dag
+ elif not task._dag:
+ task._dag = dag
Review Comment:
Not a fan for this… can we do this earlier in the stack, say when the task
is created instead?
--
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]