class_docstr: LocalTaskJob runs a single task instance.
class_docstr_tok: ["LocalTaskJob","runs","a","single","task","instance","."]
docstr: Handle case where self.task_runner exits by itself or is externally killed.
  
  Don't run any callbacks.
docstr_tok: ["Handle","case","where","self.task_runner","exits","by","itself","or","is","externally","killed",".","Do","n't","run","any","callbacks","."]
code: def handle_task_exit(self, return_code: int) -> None:
      """
      Handle case where self.task_runner exits by itself or is externally killed.
  
      Don't run any callbacks.
      """
      # Without setting this, heartbeat may get us
      self.terminating = True
      self._log_return_code_metric(return_code)
      is_deferral = return_code == TaskReturnCode.DEFERRED.value
      if is_deferral:
          self.log.info(
              "Task exited with return code %s (task deferral)",
              return_code,
          )
          _set_task_deferred_context_var()
      else:
          self.log.info("Task exited with return code %s", return_code)
  
      if not (self.task_instance.test_mode or is_deferral):
          if conf.getboolean(
              "scheduler",
              "schedule_after_task_execution",
              fallback=True,
          ):
              self.task_instance.schedule_downstream_tasks(
                  max_tis_per_query=self.job.max_tis_per_query
              )
  
imports: from __future__ import annotations
  import signal
  from typing import TYPE_CHECKING
  import psutil
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException
  from airflow.jobs.base_job_runner import BaseJobRunner
  from airflow.jobs.job import perform_heartbeat
  from airflow.models.taskinstance import TaskReturnCode
  from airflow.stats import Stats
  from airflow.utils import timezone
  from airflow.utils.log.file_task_handler import _set_task_deferred_context_var
  from airflow.utils.log.logging_mixin import LoggingMixin
  from airflow.utils.net import get_hostname
  from airflow.utils.platform import IS_WINDOWS
  from airflow.utils.session import NEW_SESSION, provide_session
  from airflow.utils.state import TaskInstanceState
label_desc: Use image node_id 3 for calling the LocalTaskJobRunner obj's underlying member method code with example usage: obj.handle_task_exit(return_code) without return types