code: def test_mark_failure_externally(ti):
      assert State.RUNNING == ti.state
      with create_session() as session:
          ti.log.info("Marking TI as failed 'externally'")
          ti.state = State.FAILED
          session.merge(ti)
          session.commit()
  
      # This should not happen -- the state change should be noticed and the task should get killed
      sleep(10)
      assert False
  
file_path: airflow/tests/dags/test_mark_state.py
imports: from __future__ import annotations
  from datetime import datetime
  from time import sleep
  from airflow.models.dag import DAG
  from airflow.operators.python import PythonOperator
  from airflow.utils.session import create_session
  from airflow.utils.state import State
label_desc: Use image node_id 4 for calling a global function with example usage: test_mark_failure_externally(ti) without return types