code: def running_subdag(admin_client, dag_maker):
      with dag_maker(dag_id="running_dag.subdag") as subdag:
          EmptyOperator(task_id="empty")
  
      with pytest.deprecated_call(), dag_maker(
          dag_id="running_dag"
      ) as dag:
          SubDagOperator(task_id="subdag", subdag=subdag)
  
      dag_bag = DagBag(include_examples=False)
      dag_bag.bag_dag(dag, root_dag=dag)
  
      with create_session() as session:
          # This writes both DAGs to DagModel, but only serialize the parent DAG.
          dag_bag.sync_to_db(session=session)
  
          # Simulate triggering the SubDagOperator to run the subdag.
          logical_date = timezone.datetime(2016, 1, 1)
          subdag.create_dagrun(
              run_id="blocked_run_example_bash_operator",
              state=State.RUNNING,
              execution_date=logical_date,
              data_interval=(logical_date, logical_date),
              start_date=timezone.datetime(2016, 1, 1),
              session=session,
          )
  
          # Now delete the parent DAG but leave the subdag.
          session.query(DagModel).filter(
              DagModel.dag_id == dag.dag_id
          ).delete()
          session.query(SerializedDagModel).filter(
              SerializedDagModel.dag_id == dag.dag_id
          ).delete()
  
      yield subdag
  
      with create_session() as session:
          session.query(DagModel).filter(
              DagModel.dag_id == subdag.dag_id
          ).delete()
      clear_db_runs()
  
file_path: airflow/tests/www/views/test_views_blocked.py
imports: from __future__ import annotations
  import pytest
  from airflow.models import DagModel
  from airflow.models.dagbag import DagBag
  from airflow.models.serialized_dag import SerializedDagModel
  from airflow.operators.empty import EmptyOperator
  from airflow.operators.subdag import SubDagOperator
  from airflow.utils import timezone
  from airflow.utils.session import create_session
  from airflow.utils.state import State
  from tests.test_utils.db import clear_db_runs
label_desc: Use image node_id 1 for calling a global function with example usage: running_subdag(admin_client, dag_maker) without return types