code: def _execute_in_fork(
      command_to_exec: CommandType, celery_task_id: str | None = None
  ) -> None:
      pid = os.fork()
      if pid:
          # In parent, wait for the child
          pid, ret = os.waitpid(pid, 0)
          if ret == 0:
              return
  
          msg = f"Celery command failed on host: {get_hostname()} with celery_task_id {celery_task_id}"
          raise AirflowException(msg)
  
      from airflow.sentry import Sentry
  
      ret = 1
      try:
          from airflow.cli.cli_parser import get_parser
  
          settings.engine.pool.dispose()
          settings.engine.dispose()
  
          parser = get_parser()
          # [1:] - remove "airflow" from the start of the command
          args = parser.parse_args(command_to_exec[1:])
          args.shut_down_logging = False
          if celery_task_id:
              args.external_executor_id = celery_task_id
  
          setproctitle(f"airflow task supervisor: {command_to_exec}")
          args.func(args)
          ret = 0
      except Exception:
          log.exception("[%s] Failed to execute task.", celery_task_id)
          ret = 1
      finally:
          Sentry.flush()
          logging.shutdown()
          os._exit(ret)
  
imports: from __future__ import annotations
  import contextlib
  import logging
  import math
  import os
  import subprocess
  import traceback
  import warnings
  from concurrent.futures import ProcessPoolExecutor
  from typing import TYPE_CHECKING, Any, Mapping, MutableMapping, Optional, Tuple
  from celery import Celery, Task, states
  from celery.backends.base import BaseKeyValueStoreBackend
  from celery.backends.database import DatabaseBackend, Task, retry, session_cleanup
  from celery.signals import import_modules
  from setproctitle import setproctitle
  from sqlalchemy import select
  import airflow.settings
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, RemovedInAirflow3Warning
  from airflow.executors.base_executor import BaseExecutor
  from airflow.stats import Stats
  from airflow.utils.dag_parsing_context import _airflow_parsing_context_manager
  from airflow.utils.log.logging_mixin import LoggingMixin
  from airflow.utils.net import get_hostname
  from airflow.utils.providers_configuration_loader import providers_configuration_loaded
  from airflow.utils.timeout import timeout
label_desc: Use image node_id 4 for calling a global function with example usage: _execute_in_fork(command_to_exec, celery_task_id) without return types