class_docstr: CeleryExecutor is recommended for production use of Airflow.
  
  It allows distributing the execution of task instances to multiple worker nodes.
  
  Celery is a simple, flexible and reliable distributed system to process
  vast amounts of messages, while providing operations with the tools
  required to maintain such a system.
class_docstr_tok: ["CeleryExecutor","is","recommended","for","production","use","of","Airflow",".","It","allows","distributing","the","execution","of","task","instances","to","multiple","worker","nodes",".","Celery","is","a","simple",",","flexible","and","reliable","distributed","system","to","process","vast","amounts","of","messages",",","while","providing","operations","with","the","tools","required","to","maintain","such","a","system","."]
code: def _send_tasks_to_celery(
      self, task_tuples_to_send: list[TaskInstanceInCelery]
  ):
      from airflow.providers.celery.executors.celery_executor_utils import (
          send_task_to_executor,
      )
  
      if len(task_tuples_to_send) == 1 or self._sync_parallelism == 1:
          # One tuple, or max one process -> send it in the main thread.
          return list(map(send_task_to_executor, task_tuples_to_send))
  
      # Use chunks instead of a work queue to reduce context switching
      # since tasks are roughly uniform in size
      chunksize = self._num_tasks_per_send_process(
          len(task_tuples_to_send)
      )
      num_processes = min(
          len(task_tuples_to_send), self._sync_parallelism
      )
  
      with ProcessPoolExecutor(max_workers=num_processes) as send_pool:
          key_and_async_results = list(
              send_pool.map(
                  send_task_to_executor,
                  task_tuples_to_send,
                  chunksize=chunksize,
              )
          )
      return key_and_async_results
  
imports: from __future__ import annotations
  import logging
  import math
  import operator
  import time
  from collections import Counter
  from concurrent.futures import ProcessPoolExecutor
  from multiprocessing import cpu_count
  from typing import TYPE_CHECKING, Any, Optional, Sequence, Tuple
  from celery import states
  from airflow.configuration import conf
  from airflow.exceptions import AirflowTaskTimeout
  from airflow.executors.base_executor import BaseExecutor
  from airflow.stats import Stats
  from airflow.utils.state import TaskInstanceState
label_desc: Use image node_id 5 for calling the CeleryExecutor obj's underlying member method code with example usage: obj._send_tasks_to_celery(task_tuples_to_send) and returns: key_and_async_results, list