code: def set_args_from_config(args, config, override_args):
      # Controller
      controller = config.get("controller")
      if controller and not args.use_gloo and not args.use_mpi:
          if controller.lower() == "gloo":
              args.use_gloo = True
          elif controller.lower() == "mpi":
              args.use_mpi = True
          else:
              raise ValueError(
                  "No such controller supported: {}".format(controller)
              )
  
      # Params
      params = config.get("params")
      if params:
          _set_arg_from_config(
              args, "fusion_threshold_mb", override_args, params
          )
          _set_arg_from_config(
              args, "cycle_time_ms", override_args, params
          )
          _set_arg_from_config(
              args, "cache_capacity", override_args, params
          )
          _set_arg_from_config(
              args, "hierarchical_allreduce", override_args, params
          )
          _set_arg_from_config(
              args, "hierarchical_allgather", override_args, params
          )
          _set_arg_from_config(
              args, "torus_allreduce", override_args, params
          )
  
      # Autotune
      autotune = config.get("autotune")
      if autotune:
          args.autotune = (
              autotune.get("enabled", False)
              if "autotune" not in override_args
              else args.autotune
          )
          _set_arg_from_config(
              args,
              "log_file",
              override_args,
              autotune,
              arg_prefix="autotune_",
          )
          _set_arg_from_config(
              args,
              "warmup_samples",
              override_args,
              autotune,
              arg_prefix="autotune_",
          )
          _set_arg_from_config(
              args,
              "steps_per_sample",
              override_args,
              autotune,
              arg_prefix="autotune_",
          )
          _set_arg_from_config(
              args,
              "bayes_opt_max_samples",
              override_args,
              autotune,
              arg_prefix="autotune_",
          )
          _set_arg_from_config(
              args,
              "gaussian_process_noise",
              override_args,
              autotune,
              arg_prefix="autotune_",
          )
  
      # Timeline
      timeline = config.get("timeline")
      if timeline:
          _set_arg_from_config(
              args,
              "filename",
              override_args,
              timeline,
              arg_prefix="timeline_",
          )
          _set_arg_from_config(
              args,
              "mark_cycles",
              override_args,
              timeline,
              arg_prefix="timeline_",
          )
  
      # Stall Check
      stall_check = config.get("stall_check")
      if stall_check:
          args.no_stall_check = (
              not stall_check.get("enabled", True)
              if "no_stall_check" not in override_args
              else args.no_stall_check
          )
          _set_arg_from_config(
              args,
              "warning_time_seconds",
              override_args,
              stall_check,
              arg_prefix="stall_check_",
          )
          _set_arg_from_config(
              args,
              "shutdown_time_seconds",
              override_args,
              stall_check,
              arg_prefix="stall_check_",
          )
  
      # Library Options
      library_options = config.get("library_options")
      if library_options:
          _set_arg_from_config(
              args,
              "mpi_threads_disable",
              override_args,
              library_options,
          )
          _set_arg_from_config(
              args, "num_nccl_streams", override_args, library_options
          )
          _set_arg_from_config(
              args, "thread_affinity", override_args, library_options
          )
          _set_arg_from_config(
              args,
              "gloo_timeout_seconds",
              override_args,
              library_options,
          )
  
      # Logging
      logging = config.get("logging")
      if logging:
          _set_arg_from_config(
              args, "level", override_args, logging, arg_prefix="log_"
          )
          _set_arg_from_config(
              args,
              "with_timestamp",
              override_args,
              logging,
              arg_prefix="log_",
          )
  
imports: import logging
label_desc: Use image node_id 2 for calling a global function with example usage: set_args_from_config(args, config, override_args) without return types