cls._context_managed_dags.appendleft(dag)
    @classmethod
    def pop_context_managed_dag(cls) -> DAG | None:
        dag = cls._context_managed_dags.popleft()
        
        if cls.current_autoregister_module_name is not None and dag and dag.auto_register:
            mod = sys.modules[cls.current_autoregister_module_name]
            cls.autoregistered_dags.add((dag, mod))
        return dag
    @classmethod
    def get_current_dag(cls) -> DAG | None:
        try:
            return cls._context_managed_dags[0]
        except IndexError:
            return None
def _run_task(ti: TaskInstance, session):