code: def on_task_instance_success(
      previous_state: TaskInstanceState,
      task_instance: TaskInstance,
      session,
  ):
      """
      This method is called when task state changes to SUCCESS.
      Through callback, parameters like previous_task_state, task_instance object can be accessed.
      This will give more information about current task_instance that has succeeded its
      dag_run, task and dag information.
      """
      print("Task instance in success state")
      print(" Previous state of the Task instance:", previous_state)
  
      dag_id = task_instance.dag_id
      hostname = task_instance.hostname
      operator = task_instance.operator
  
      dagrun = task_instance.dag_run
      queued_at = dagrun.queued_at
      print(f"Dag name:{dag_id} queued_at:{queued_at}")
      print(f"Task hostname:{hostname} operator:{operator}")
  
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 2 for calling a global function with example usage: on_task_instance_success(previous_state, task_instance, session) without return types