code: def test_set_running_dag_run_to_failed(self):
      date = self.execution_dates[0]
      dr = self._create_test_dag_run(State.RUNNING, date)
      middle_time = timezone.utcnow()
      self._set_default_task_instance_states(dr)
  
      altered = set_dag_run_state_to_failed(
          dag=self.dag1, run_id=dr.run_id, commit=True
      )
      # Only non-completed tasks should be altered.
      expected = self._get_num_tasks_with_non_completed_state()
      assert len(altered) == expected
      self._verify_dag_run_state(self.dag1, date, State.FAILED)
      assert (
          dr.get_task_instance("run_after_loop").state == State.FAILED
      )
      self._verify_dag_run_dates(
          self.dag1, date, State.FAILED, middle_time
      )
  
imports: from __future__ import annotations
  import datetime
  from typing import Callable
  import pytest
  from sqlalchemy.orm import eagerload
  from airflow import models
  from airflow.api.common.mark_tasks import _create_dagruns, _DagRunInfo, set_dag_run_state_to_failed, set_dag_run_state_to_queued, set_dag_run_state_to_running, set_dag_run_state_to_success, set_state
  from airflow.models import DagRun
  from airflow.utils import timezone
  from airflow.utils.session import create_session, provide_session
  from airflow.utils.state import State
  from airflow.utils.types import DagRunType
  from tests.test_utils.db import clear_db_runs
  from tests.test_utils.mapping import expand_mapped_task
label_desc: Use image node_id 13 for calling the TestMarkDAGRun obj's underlying member method code with example usage: obj.test_set_running_dag_run_to_failed() without return types