code: def task_instance():
      dag = DAG(DAG_ID, start_date=DEFAULT_DATE)
      task = EmptyOperator(task_id=TASK_ID, dag=dag)
      dagrun = dag.create_dagrun(
          DagRunState.RUNNING,
          execution_date=DEFAULT_DATE,
          run_type=DagRunType.MANUAL,
      )
      ti = TaskInstance(task=task, run_id=dagrun.run_id)
      ti.log.disabled = False
      yield ti
      clear_db_runs()
  
file_path: airflow/tests/utils/test_task_handler_with_custom_formatter.py
imports: from __future__ import annotations
  import logging
  import pytest
  from airflow.config_templates.airflow_local_settings import DEFAULT_LOGGING_CONFIG
  from airflow.models.dag import DAG
  from airflow.models.taskinstance import TaskInstance
  from airflow.operators.empty import EmptyOperator
  from airflow.utils.log.logging_mixin import set_context
  from airflow.utils.state import DagRunState
  from airflow.utils.timezone import datetime
  from airflow.utils.types import DagRunType
  from tests.test_utils.config import conf_vars
  from tests.test_utils.db import clear_db_runs
label_desc: Use image node_id 2 for calling a global function with example usage: task_instance() without return types