Skip to content

flex_rf.web.Batch

Type: class Base(s): WebContainer

Interface for submitting several Simulation objects to sever.

Commonly one needs to submit a batch of Simulation. The built-in Batch object is the best way to upload, start, monitor, and load a series of tasks. The batch object is like a Job, but stores task metadata for a series of simulations.

simulations [dict[TaskName, discriminated_union(WorkflowType)] | tuple[discriminated_union(WorkflowType), ...]]

Mapping of task names to Simulations to run as a batch.

folder_name [str] = 'default'

Name of folder to store member of each batch on web UI.

verbose [bool] = True

Whether to print info messages and progressbars.

solver_version [str | None] = None

Custom solver version to use, otherwise uses default for the current front end version.

callback_url [str | None] = None

Http PUT url to receive simulation finish event. The body content is a json file with fields {'id', 'status', 'name', 'workUnit', 'solverVersion'}.

simulation_type [BatchCategoryType | None] = None

Type of each simulation in the batch, used internally only.

parent_tasks [dict[str, tuple[TaskId, ...]] | None] = None

Collection of parent task ids for each job in batch, used internally only.

num_workers [PositiveInt | None] = factory: _default_batch_num_workers

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.

reduce_simulation [Literal['auto', True, False]] = 'auto'

Whether to reduce structures in the simulation to the simulation domain only. Note: currently only implemented for the mode solver.

pay_type [PayType | None] = None

Specify the payment method.

jobs_cached [dict[TaskName, Job] | None] = None

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.

lazy [bool] = False

Whether to load the actual data (lazy=False) or return a proxy that loads the data when accessed (lazy=True).

num_jobs [int]

Number of jobs in the batch.

delete()

Delete server-side data associated with each task in the batch.

download(path_dir: PathLike = DEFAULT_DATA_DIR, replace_existing: bool = False)

Download results of each task.

estimate_cost(verbose: bool = True)

Compute the maximum FlexCredit charge for a given Batch.

from_file(fname: PathLike, group_path: str | None = None, lazy: bool = False, on_load: Callable[[Any], None] | None = None, **parse_obj_kwargs: Any)

Load a Batch from file.

get_info()

Get information about each task in the Batch.

get_run_info()

get information about a each of the tasks in the Batch.

jobs()

Create a series of tasks in the Batch and upload them to server.

load(path_dir: PathLike = DEFAULT_DATA_DIR, replace_existing: bool = False, skip_download: bool = False)

Download results and load them into BatchData object.

monitor(*, download_on_success: bool = False, path_dir: PathLike = DEFAULT_DATA_DIR, replace_existing: bool = False)

Monitor progress of each running task.

real_cost(verbose: bool = True)

Get the sum of billed costs for each task associated with this batch.

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)

Upload and run each simulation in Batch.

start(priority: int | None = None, vgpu_allocation: int | None = None, ignore_memory_limit: bool | None = None)

Start running all tasks in the Batch.

to_file(fname: PathLike)

Exports Tidy3dBaseModel instance to .yaml, .json, or .hdf5 file

upload()

Upload a series of tasks associated with this Batch using multi-threading.