https://github.com/apache/airflow/blob/main/airflow/cli/commands/task_command.py#L145
"""Get the status of all task instances in a DagRun."""
    dag_run = session.scalar(
        select(DagRun).where(DagRun.run_id == args.execution_date_or_run_id, DagRun.dag_id == args.dag_id)
    )
    if not dag_run:
        try:
            execution_date = timezone.parse(args.execution_date_or_run_id)
            dag_run = session.scalar(
                select(DagRun).where(DagRun.execution_date == execution_date, DagRun.dag_id == args.dag_id)
            )
        except (ParserError, TypeError) as err:
            raise AirflowException(f"Error parsing the supplied execution_date. Error: {err}")
    if dag_run is None:
        raise DagRunNotFound(
            f"DagRun for {args.dag_id} with run_id or execution_date of {args.execution_date_or_run_id!r} "
            "not found"
        )
    has_mapped_instances = any(ti.map_index >= 0 for ti in dag_run.task_instances)
    def format_task_instance(ti: TaskInstance) -> dict[str, str]: