{
  "title": "Batch",
  "public_path": "flex_rf.web.Batch",
  "lookup_path": "tidy3d.web.Batch",
  "slug": "flex_rf/web/Batch",
  "public_url": "/rf/latest/autogenerated/flex_rf/web/batch/",
  "object_kind": "class",
  "introduction": "Interface for submitting several `Simulation` objects to sever.",
  "notes": "Commonly one needs to submit a batch of `Simulation`. The built-in\n`Batch` object is the best way to upload, start, monitor, and load a series of\ntasks. The batch object is like a `Job`, but stores task metadata for a series of\nsimulations.",
  "examples": "",
  "references": "",
  "signature": "class Batch(WebContainer)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/web/api/container.py",
    "url": "",
    "lineno": 824,
    "endlineno": 1978
  },
  "bases": [
    "WebContainer"
  ],
  "parameter_rows": [
    {
      "name": "simulations",
      "annotation": "dict[TaskName, discriminated_union(WorkflowType)] | tuple[discriminated_union(WorkflowType), ...]",
      "default": "",
      "description": "Mapping of task names to Simulations to run as a batch.",
      "origin": "declared"
    },
    {
      "name": "folder_name",
      "annotation": "str",
      "default": "'default'",
      "description": "Name of folder to store member of each batch on web UI.",
      "origin": "declared"
    },
    {
      "name": "verbose",
      "annotation": "bool",
      "default": "True",
      "description": "Whether to print info messages and progressbars.",
      "origin": "declared"
    },
    {
      "name": "solver_version",
      "annotation": "str | None",
      "default": "None",
      "description": "Custom solver version to use, otherwise uses default for the current front end version.",
      "origin": "declared"
    },
    {
      "name": "callback_url",
      "annotation": "str | None",
      "default": "None",
      "description": "Http PUT url to receive simulation finish event. The body content is a json file with fields `{'id', 'status', 'name', 'workUnit', 'solverVersion'}`.",
      "origin": "declared"
    },
    {
      "name": "simulation_type",
      "annotation": "BatchCategoryType | None",
      "default": "None",
      "description": "Type of each simulation in the batch, used internally only.",
      "origin": "declared"
    },
    {
      "name": "parent_tasks",
      "annotation": "dict[str, tuple[TaskId, ...]] | None",
      "default": "None",
      "description": "Collection of parent task ids for each job in batch, used internally only.",
      "origin": "declared"
    },
    {
      "name": "num_workers",
      "annotation": "PositiveInt | None",
      "default": "factory: _default_batch_num_workers",
      "description": "Number of workers for batch multi-threading where configurable. Corresponds to `max_workers` argument passed to `concurrent.futures.ThreadPoolExecutor`. Upload/start use a fixed concurrency of 64. Defaults to `config.web.default_num_workers`.",
      "origin": "declared"
    },
    {
      "name": "reduce_simulation",
      "annotation": "Literal['auto', True, False]",
      "default": "'auto'",
      "description": "Whether to reduce structures in the simulation to the simulation domain only. Note: currently only implemented for the mode solver.",
      "origin": "declared"
    },
    {
      "name": "pay_type",
      "annotation": "PayType | None",
      "default": "None",
      "description": "Specify the payment method.",
      "origin": "declared"
    },
    {
      "name": "jobs_cached",
      "annotation": "dict[TaskName, Job] | None",
      "default": "None",
      "description": "Optional field to specify `jobs`. Only used as a workaround internally so that `jobs` is written when `Batch.to_file()` and then the proper task is loaded from `Batch.from_file()`. We recommend leaving unset as setting this field along with fields that were not used to create the task will cause errors.",
      "origin": "declared"
    },
    {
      "name": "lazy",
      "annotation": "bool",
      "default": "False",
      "description": "Whether to load the actual data (lazy=False) or return a proxy that loads the data when accessed (lazy=True).",
      "origin": "declared"
    },
    {
      "name": "attrs",
      "annotation": "dict",
      "default": "factory: dict",
      "description": "Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, `attrs` are mutable. For example, the following is allowed for setting an `attr` `obj.attrs['foo'] = bar`. Also note that Tidy3D will raise a `TypeError` if `attrs` contain objects that can not be serialized. One can check if `attrs` are serializable by calling `obj.model_dump_json()`.",
      "origin": "inherited"
    }
  ],
  "members": [
    {
      "name": "delete",
      "kind": "function",
      "signature": "delete()",
      "description": "Delete server-side data associated with each task in the batch."
    },
    {
      "name": "download",
      "kind": "function",
      "signature": "download(path_dir: PathLike = DEFAULT_DATA_DIR, replace_existing: bool = False)",
      "description": "Download results of each task."
    },
    {
      "name": "estimate_cost",
      "kind": "function",
      "signature": "estimate_cost(verbose: bool = True)",
      "description": "Compute the maximum FlexCredit charge for a given `Batch`."
    },
    {
      "name": "from_file",
      "kind": "function",
      "signature": "from_file(fname: PathLike, group_path: str | None = None, lazy: bool = False, on_load: Callable[[Any], None] | None = None, **parse_obj_kwargs: Any)",
      "description": "Load a `Batch` from file."
    },
    {
      "name": "get_info",
      "kind": "function",
      "signature": "get_info()",
      "description": "Get information about each task in the `Batch`."
    },
    {
      "name": "get_run_info",
      "kind": "function",
      "signature": "get_run_info()",
      "description": "get information about a each of the tasks in the `Batch`."
    },
    {
      "name": "jobs",
      "kind": "function",
      "signature": "jobs()",
      "description": "Create a series of tasks in the `Batch` and upload them to server."
    },
    {
      "name": "load",
      "kind": "function",
      "signature": "load(path_dir: PathLike = DEFAULT_DATA_DIR, replace_existing: bool = False, skip_download: bool = False)",
      "description": "Download results and load them into `BatchData` object."
    },
    {
      "name": "monitor",
      "kind": "function",
      "signature": "monitor(*, download_on_success: bool = False, path_dir: PathLike = DEFAULT_DATA_DIR, replace_existing: bool = False)",
      "description": "Monitor progress of each running task."
    },
    {
      "name": "num_jobs",
      "kind": "attribute",
      "signature": "num_jobs: int",
      "description": "Number of jobs in the batch."
    },
    {
      "name": "real_cost",
      "kind": "function",
      "signature": "real_cost(verbose: bool = True)",
      "description": "Get the sum of billed costs for each task associated with this batch."
    },
    {
      "name": "run",
      "kind": "function",
      "signature": "run(path_dir: PathLike = DEFAULT_DATA_DIR, priority: int | None = None, replace_existing: bool = False, vgpu_allocation: int | None = None, ignore_memory_limit: bool | None = None)",
      "description": "Upload and run each simulation in `Batch`."
    },
    {
      "name": "start",
      "kind": "function",
      "signature": "start(priority: int | None = None, vgpu_allocation: int | None = None, ignore_memory_limit: bool | None = None)",
      "description": "Start running all tasks in the `Batch`."
    },
    {
      "name": "to_file",
      "kind": "function",
      "signature": "to_file(fname: PathLike)",
      "description": "Exports `Tidy3dBaseModel` instance to .yaml, .json, or .hdf5 file"
    },
    {
      "name": "upload",
      "kind": "function",
      "signature": "upload()",
      "description": "Upload a series of tasks associated with this `Batch` using multi-threading."
    }
  ],
  "group": "flex_rf.web"
}
