class_docstr: Triggers a DAG run for a specified ``dag_id``.
  
  :param trigger_dag_id: The dag_id to trigger (templated).
  :param trigger_run_id: The run ID to use for the triggered DAG run (templated).
      If not provided, a run ID will be automatically generated.
  :param conf: Configuration for the DAG run (templated).
  :param execution_date: Execution date for the dag (templated).
  :param reset_dag_run: Whether clear existing dag run if already exists.
      This is useful when backfill or rerun an existing dag run.
      This only resets (not recreates) the dag run.
      Dag run conf is immutable and will not be reset on rerun of an existing dag run.
      When reset_dag_run=False and dag run exists, DagRunAlreadyExists will be raised.
      When reset_dag_run=True and dag run exists, existing dag run will be cleared to rerun.
  :param wait_for_completion: Whether or not wait for dag run completion. (default: False)
  :param poke_interval: Poke interval to check dag run status when wait_for_completion=True.
      (default: 60)
  :param allowed_states: List of allowed states, default is ``['success']``.
  :param failed_states: List of failed or dis-allowed states, default is ``None``.
  :param deferrable: If waiting for completion, whether or not to defer the task until done,
      default is ``False``.
class_docstr_tok: ["Triggers","a","DAG","run","for","a","specified","``","dag_id","``",".",":","param","trigger_dag_id",":","The","dag_id","to","trigger","(","templated",")",".",":","param","trigger_run_id",":","The","run","ID","to","use","for","the","triggered","DAG","run","(","templated",")",".","If","not","provided",",","a","run","ID","will","be","automatically","generated",".",":","param","conf",":","Configuration","for","the","DAG","run","(","templated",")",".",":","param","execution_date",":","Execution","date","for","the","dag","(","templated",")",".",":","param","reset_dag_run",":","Whether","clear","existing","dag","run","if","already","exists",".","This","is","useful","when","backfill","or","rerun","an","existing","dag","run",".","This","only","resets","(","not","recreates",")","the","dag","run",".","Dag","run","conf","is","immutable","and","will","not","be","reset","on","rerun","of","an","existing","dag","run",".","When","reset_dag_run=False","and","dag","run","exists",",","DagRunAlreadyExists","will","be","raised",".","When","reset_dag_run=True","and","dag","run","exists",",","existing","dag","run","will","be","cleared","to","rerun",".",":","param","wait_for_completion",":","Whether","or","not","wait","for","dag","run","completion",".","(","default",":","False",")",":","param","poke_interval",":","Poke","interval","to","check","dag","run","status","when","wait_for_completion=True",".","(","default",":","60",")",":","param","allowed_states",":","List","of","allowed","states",",","default","is","``","[","'success","'","]","``",".",":","param","failed_states",":","List","of","failed","or","dis-allowed","states",",","default","is","``","None","``",".",":","param","deferrable",":","If","waiting","for","completion",",","whether","or","not","to","defer","the","task","until","done",",","default","is","``","False","``","."]
code: def execute(self, context: Context):
      if isinstance(self.execution_date, datetime.datetime):
          parsed_execution_date = self.execution_date
      elif isinstance(self.execution_date, str):
          parsed_execution_date = timezone.parse(self.execution_date)
      else:
          parsed_execution_date = timezone.utcnow()
  
      try:
          json.dumps(self.conf)
      except TypeError:
          raise AirflowException(
              "conf parameter should be JSON Serializable"
          )
  
      if self.trigger_run_id:
          run_id = str(self.trigger_run_id)
      else:
          run_id = DagRun.generate_run_id(
              DagRunType.MANUAL, parsed_execution_date
          )
  
      try:
          dag_run = trigger_dag(
              dag_id=self.trigger_dag_id,
              run_id=run_id,
              conf=self.conf,
              execution_date=parsed_execution_date,
              replace_microseconds=False,
          )
  
      except DagRunAlreadyExists as e:
          if self.reset_dag_run:
              self.log.info(
                  "Clearing %s on %s",
                  self.trigger_dag_id,
                  parsed_execution_date,
              )
  
              # Get target dag object and call clear()
              dag_model = DagModel.get_current(self.trigger_dag_id)
              if dag_model is None:
                  raise DagNotFound(
                      f"Dag id {self.trigger_dag_id} not found in DagModel"
                  )
  
              dag_bag = DagBag(
                  dag_folder=dag_model.fileloc, read_dags_from_db=True
              )
              dag = dag_bag.get_dag(self.trigger_dag_id)
              dag_run = e.dag_run
              dag.clear(
                  start_date=dag_run.execution_date,
                  end_date=dag_run.execution_date,
              )
          else:
              raise e
      if dag_run is None:
          raise RuntimeError("The dag_run should be set here!")
      # Store the execution date from the dag run (either created or found above) to
      # be used when creating the extra link on the webserver.
      ti = context["task_instance"]
      ti.xcom_push(
          key=XCOM_EXECUTION_DATE_ISO,
          value=dag_run.execution_date.isoformat(),
      )
      ti.xcom_push(key=XCOM_RUN_ID, value=dag_run.run_id)
  
      if self.wait_for_completion:
          # Kick off the deferral process
          if self._defer:
              self.defer(
                  trigger=DagStateTrigger(
                      dag_id=self.trigger_dag_id,
                      states=self.allowed_states + self.failed_states,
                      execution_dates=[parsed_execution_date],
                      poll_interval=self.poke_interval,
                  ),
                  method_name="execute_complete",
              )
          # wait for dag to complete
          while True:
              self.log.info(
                  "Waiting for %s on %s to become allowed state %s ...",
                  self.trigger_dag_id,
                  dag_run.execution_date,
                  self.allowed_states,
              )
              time.sleep(self.poke_interval)
  
              dag_run.refresh_from_db()
              state = dag_run.state
              if state in self.failed_states:
                  raise AirflowException(
                      f"{self.trigger_dag_id} failed with failed states {state}"
                  )
              if state in self.allowed_states:
                  self.log.info(
                      "%s finished with allowed state %s",
                      self.trigger_dag_id,
                      state,
                  )
                  return
  
imports: from __future__ import annotations
  import datetime
  import json
  import time
  from typing import TYPE_CHECKING, Any, Sequence, cast
  from sqlalchemy import select
  from sqlalchemy.orm.exc import NoResultFound
  from airflow.api.common.trigger_dag import trigger_dag
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, DagNotFound, DagRunAlreadyExists
  from airflow.models.baseoperator import BaseOperator
  from airflow.models.baseoperatorlink import BaseOperatorLink
  from airflow.models.dag import DagModel
  from airflow.models.dagbag import DagBag
  from airflow.models.dagrun import DagRun
  from airflow.models.xcom import XCom
  from airflow.triggers.external_task import DagStateTrigger
  from airflow.utils import timezone
  from airflow.utils.helpers import build_airflow_url_with_query
  from airflow.utils.session import provide_session
  from airflow.utils.state import DagRunState
  from airflow.utils.types import DagRunType
label_desc: Use image node_id 2 for calling the TriggerDagRunOperator obj's underlying member method code with example usage: obj.execute(context) without return types