Used in https://github.com/mhenc/airflow/blob/master/airflow/dag_processing/manager.py#L613

should be straighforward
if visited_external_tis is None:
                visited_external_tis = set()
            for ti in query.filter(TI.operator == ExternalTaskMarker.__name__):
                ti_key = ti.key.primary
                if ti_key in visited_external_tis:
                    continue
                visited_external_tis.add(ti_key)
                task: ExternalTaskMarker = cast(ExternalTaskMarker, copy.copy(self.get_task(ti.task_id)))
                ti.task = task
                if max_recursion_depth is None:
                    
                    
                    max_recursion_depth = task.recursion_depth
                if recursion_depth + 1 > max_recursion_depth:
                    
                    raise AirflowException(
                        f"Maximum recursion depth {max_recursion_depth} reached for "
                        f"{ExternalTaskMarker.__name__} {ti.task_id}. "
                        f"Attempted to clear too many tasks or there may be a cyclic dependency."
                    )
                ti.render_templates()
                external_tis = (
                    session.query(TI)
                    .join(TI.dag_run)
                    .filter(
                        TI.dag_id == task.external_dag_id,
                        TI.task_id == task.external_task_id,
                        DagRun.execution_date == pendulum.parse(task.execution_date),
                    )
                )