code: def define_worker_config(config):
      """Create and define the fields of the worker configuration."""
      worker_config = Configuration()
  
      worker_config.add_option(
          "n_workers",
          option_type=int,
          default=1,
          env_var="ORION_N_WORKERS",
          help=(
              "Number of workers to run in parallel. "
              "It is possible to run many ``orion hunt`` in parallel, and each will spawn "
              "``n_workers``."
          ),
      )
  
      worker_config.add_option(
          "pool_size",
          option_type=int,
          default=0,
          env_var="ORION_POOL_SIZE",
          help=(
              "Number of trials to sample at a time. "
              "If 0, will default to number of executor workers. "
              "Increase it to improve the sampling speed if workers spend too much time "
              "waiting for algorithms to sample points. An algorithm will try sampling "
              "`pool-size` trials but may return less."
          ),
      )
  
      worker_config.add_option(
          "executor",
          option_type=str,
          default="PoolExecutor",
          env_var="ORION_EXECUTOR",
          help="The executor backend used to parallelize orion workers.",
      )
  
      worker_config.add_option(
          "executor_configuration",
          option_type=dict,
          default={},
          help=(
              "The configuration of the executor. See "
              "https://orion.readthedocs.io/en/stable/code/executor.html for documentation "
              "of executors configuration."
          ),
      )
  
      worker_config.add_option(
          "heartbeat",
          option_type=int,
          default=120,
          env_var="ORION_HEARTBEAT",
          help=(
              "Frequency (seconds) at which the heartbeat of the trial is updated. "
              "If the heartbeat of a `reserved` trial is larger than twice the configured "
              "heartbeat, Oríon will reset the status of the trial to `interrupted`. "
              "This allows restoring lost trials (ex: due to killed worker)."
          ),
      )
  
      worker_config.add_option(
          "max_trials",
          option_type=int,
          default=int(10e8),
          env_var="ORION_WORKER_MAX_TRIALS",
          help="number of trials to be completed for this worker. "
          "If the experiment is completed, the worker will die even if it "
          "did not reach its maximum number of trials ",
      )
  
      worker_config.add_option(
          "max_broken",
          option_type=int,
          default=3,
          env_var="ORION_WORKER_MAX_BROKEN",
          help=("Maximum number of broken trials before worker stops."),
      )
  
      worker_config.add_option(
          "max_idle_time",
          option_type=int,
          default=60,
          env_var="ORION_MAX_IDLE_TIME",
          deprecate=dict(
              version="v0.3",
              alternative="worker.idle_timeout",
              name="worker.max_idle_time",
          ),
          help=(
              "This argument will be removed in v0.3.0. Use idle_timeout instead."
          ),
      )
  
      worker_config.add_option(
          "idle_timeout",
          option_type=int,
          default=60,
          env_var="ORION_IDLE_TIMEOUT",
          help=(
              "Maximum time the workers can spend without work."
              "Such timeout generally occur when reaching the end of the optimization"
              "when no new trials can be scheduled"
          ),
      )
  
      worker_config.add_option(
          "interrupt_signal_code",
          option_type=int,
          default=130,
          env_var="ORION_INTERRUPT_CODE",
          help="Signal returned by user script to signal to Oríon that it was interrupted.",
      )
  
      # TODO: Will this support -config as well, or only --config?
      worker_config.add_option(
          "user_script_config",
          option_type=str,
          default="config",
          env_var="ORION_USER_SCRIPT_CONFIG",
          help="Config argument name of user's script (--config).",
      )
  
      config.worker = worker_config
  
file_path: orion/src/orion/core/__init__.py
imports: import logging
  import os
  import socket
  from appdirs import AppDirs
  from orion.core.io.config import Configuration
  from ._version import get_versions
label_desc: Use image node_id 6 for calling a global function with example usage: define_worker_config(config) without return types