class_docstr: LocalWorkerBase implementation to run airflow commands.
  
  Executes the given command and puts the result into a result queue when done, terminating execution.
  
  :param result_queue: the queue to store result state
class_docstr_tok: ["LocalWorkerBase","implementation","to","run","airflow","commands",".","Executes","the","given","command","and","puts","the","result","into","a","result","queue","when","done",",","terminating","execution",".",":","param","result_queue",":","the","queue","to","store","result","state"]
code: def _execute_work_in_fork(
      self, command: CommandType
  ) -> TaskInstanceState:
      pid = os.fork()
      if pid:
          # In parent, wait for the child
          pid, ret = os.waitpid(pid, 0)
          return (
              TaskInstanceState.SUCCESS
              if ret == 0
              else TaskInstanceState.FAILED
          )
  
      from airflow.sentry import Sentry
  
      ret = 1
      try:
          import signal
  
          from airflow.cli.cli_parser import get_parser
  
          signal.signal(signal.SIGINT, signal.SIG_DFL)
          signal.signal(signal.SIGTERM, signal.SIG_DFL)
          signal.signal(signal.SIGUSR2, signal.SIG_DFL)
  
          parser = get_parser()
          # [1:] - remove "airflow" from the start of the command
          args = parser.parse_args(command[1:])
          args.shut_down_logging = False
  
          setproctitle(f"airflow task supervisor: {command}")
  
          args.func(args)
          ret = 0
          return TaskInstanceState.SUCCESS
      except Exception as e:
          self.log.exception("Failed to execute task %s.", e)
          return TaskInstanceState.FAILED
      finally:
          Sentry.flush()
          logging.shutdown()
          os._exit(ret)
  
imports: from __future__ import annotations
  import contextlib
  import logging
  import os
  import subprocess
  from abc import abstractmethod
  from multiprocessing import Manager, Process
  from queue import Empty
  from typing import TYPE_CHECKING, Any, Optional, Tuple
  from setproctitle import getproctitle, setproctitle
  from airflow import settings
  from airflow.exceptions import AirflowException
  from airflow.executors.base_executor import PARALLELISM, BaseExecutor
  from airflow.utils.log.logging_mixin import LoggingMixin
  from airflow.utils.state import TaskInstanceState
label_desc: Use image node_id 5 for calling the LocalWorkerBase obj's underlying member method code with example usage: obj._execute_work_in_fork(command) and returns: unknown, TaskInstanceState, TaskInstanceState