code: def on_task_instance_running(
      previous_state: TaskInstanceState,
      task_instance: TaskInstance,
      session,
  ):
      """
      This method is called when task state changes to RUNNING.
      Through callback, parameters like previous_task_state, task_instance object can be accessed.
      This will give more information about current task_instance that is running its dag_run,
      task and dag information.
      """
      print("Task instance is in running state")
      print(" Previous state of the Task instance:", previous_state)
  
      state: TaskInstanceState = task_instance.state
      name: str = task_instance.task_id
      start_date = task_instance.start_date
  
      dagrun = task_instance.dag_run
      dagrun_status = dagrun.state
  
      task = task_instance.task
  
      dag = task.dag
      dag_name = None
      if dag:
          dag_name = dag.dag_id
      print(
          f"Current task name:{name} state:{state} start_date:{start_date}"
      )
      print(
          f"Dag name:{dag_name} and current dag run status:{dagrun_status}"
      )
  
file_path: airflow/airflow/example_dags/plugins/event_listener.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from airflow.listeners import hookimpl
label_desc: Use image node_id 1 for calling a global function with example usage: on_task_instance_running(previous_state, task_instance, session) without return types