code: def launch(
      launcher: RayAWSLauncher,
      job_overrides: Sequence[Sequence[str]],
      initial_job_idx: int,
  ) -> Sequence[JobReturn]:
      setup_globals()
      assert launcher.config is not None
      assert launcher.hydra_context is not None
      assert launcher.task_function is not None
  
      setup_commands = launcher.env_setup.commands
      packages = filter(
          lambda x: x[1] is not None,
          launcher.env_setup.pip_packages.items(),
      )
      with read_write(setup_commands):
          setup_commands.extend(
              [
                  f"pip install {package}=={version}"
                  for package, version in packages
              ]
          )
          setup_commands.extend(launcher.ray_cfg.cluster.setup_commands)
  
      assert isinstance(launcher.ray_cfg.cluster, Node)
      with read_write(launcher.ray_cfg.cluster):
          launcher.ray_cfg.cluster.setup_commands = setup_commands
  
      configure_log(
          launcher.config.hydra.hydra_logging,
          launcher.config.hydra.verbose,
      )
      logging_config = OmegaConf.to_container(
          launcher.logging, resolve=True, enum_to_str=True
      )
      sdk.configure_logging(**logging_config)
  
      log.info(f"Ray Launcher is launching {len(job_overrides)} jobs, ")
  
      with tempfile.TemporaryDirectory() as local_tmp_dir:
          sweep_configs = []
          for idx, overrides in enumerate(job_overrides):
              idx = initial_job_idx + idx
              ostr = " ".join(filter_overrides(overrides))
              log.info(f"\t#{idx} : {ostr}")
              sweep_config = launcher.hydra_context.config_loader.load_sweep_config(
                  launcher.config, list(overrides)
              )
              with open_dict(sweep_config):
                  # job.id will be set on the EC2 instance before running the job.
                  sweep_config.hydra.job.num = idx
  
              sweep_configs.append(sweep_config)
  
          _pickle_jobs(
              tmp_dir=local_tmp_dir,
              hydra_context=launcher.hydra_context,
              sweep_configs=sweep_configs,
              task_function=launcher.task_function,
              singleton_state=Singleton.get_state(),
          )
          return launch_jobs(
              launcher,
              local_tmp_dir,
              Path(launcher.config.hydra.sweep.dir),
          )
  
file_path: hydra/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core_aws.py
imports: import logging
  import os
  import tempfile
  from pathlib import Path
  from typing import Any, List, Sequence, Union
  import cloudpickle
  from hydra.core.singleton import Singleton
  from hydra.core.utils import JobReturn, configure_log, filter_overrides, setup_globals
  from omegaconf import Node, OmegaConf, open_dict, read_write
  from ._launcher_util import JOB_RETURN_PICKLE, JOB_SPEC_PICKLE, ray_tmp_dir, rsync
  from .ray_aws_launcher import RayAWSLauncher
label_desc: Use image node_id 3 for calling a global function with example usage: launch(launcher, job_overrides, initial_job_idx) and returns: launch_jobs