dstandish commented on code in PR #39259: URL: https://github.com/apache/airflow/pull/39259#discussion_r1623787572
########## 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 + if next(task.iter_mapped_dependants(), None) is None: # No mapped dependants, no need to validate. return # TODO: We don't push TaskMap for mapped task instances because it's not - # currently possible for a downstream to depend on one individual mapped - # task instance. This will change when we implement task mapping inside - # a mapped task group, and we'll need to further analyze the case. + # currently possible for a downstream to depend on one individual mapped + # task instance. This will change when we implement task mapping inside + # a mapped task group, and we'll need to further analyze the case. Review Comment: Yes it does and the editor prefers it that way. If you veto just let me know and I’ll revert it otherwise let’s move on -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org