class_docstr: Basic sweeper
class_docstr_tok: ["Basic","sweeper"]
code: def sweep(self, arguments: List[str]) -> Any:
      assert self.config is not None
      assert self.launcher is not None
      assert self.hydra_context is not None
  
      params_conf = self._parse_config()
      params_conf.extend(arguments)
  
      parser = OverridesParser.create(
          config_loader=self.hydra_context.config_loader
      )
      overrides = parser.parse_overrides(params_conf)
  
      self.overrides = self.split_arguments(
          overrides, self.max_batch_size
      )
      returns: List[Sequence[JobReturn]] = []
  
      # Save sweep run config in top level sweep working directory
      sweep_dir = Path(self.config.hydra.sweep.dir)
      sweep_dir.mkdir(parents=True, exist_ok=True)
      OmegaConf.save(self.config, sweep_dir / "multirun.yaml")
  
      initial_job_idx = 0
      while not self.is_done():
          batch = self.get_job_batch()
          tic = time.perf_counter()
          # Validate that jobs can be safely composed. This catches composition errors early.
          # This can be a bit slow for large jobs. can potentially allow disabling from the config.
          self.validate_batch_is_legal(batch)
          elapsed = time.perf_counter() - tic
          log.debug(
              f"Validated configs of {len(batch)} jobs in {elapsed:0.2f} seconds, {len(batch)/elapsed:.2f} / second)"
          )
          results = self.launcher.launch(
              batch, initial_job_idx=initial_job_idx
          )
  
          for r in results:
              # access the result to trigger an exception in case the job failed.
              _ = r.return_value
  
          initial_job_idx += len(batch)
          returns.append(results)
  
      return returns
  
imports: import itertools
  import logging
  import time
  from collections import OrderedDict
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, Dict, Iterable, List, Optional, Sequence
  from omegaconf import DictConfig, OmegaConf
  from hydra.core.config_store import ConfigStore
  from hydra.core.override_parser.overrides_parser import OverridesParser
  from hydra.core.override_parser.types import Override
  from hydra.core.utils import JobReturn
  from hydra.errors import HydraException
  from hydra.plugins.launcher import Launcher
  from hydra.plugins.sweeper import Sweeper
  from hydra.types import HydraContext, TaskFunction
label_desc: Use image node_id 6 for calling the BasicSweeper obj's underlying member method code with example usage: obj.sweep(arguments) and returns: returns