# Batched Solves Use batched solves to run one {term}`project` with {term}`batched project keys`. The {term}`project keys` are processed in input order. ## Run Batched Project Keys Pass batched project keys to `keys=`: ```python import jcmsuite batch = jcmsuite.solve( "project.jcmp", keys=[ {"radius": 0.3}, {"radius": 0.4}, {"radius": 0.5}, ], temporary=True, ) ``` The call returns a {class}`BatchSolveResult `. The entry at {class}`batch[0] ` belongs to the first set of project keys. ## Collect Failures Use `on_error="collect"` when one failed entry must not stop the remaining entries: ```python batch = jcmsuite.solve( "project.jcmp", keys=[{"radius": 0.3}, {"radius": 0.4}, {"radius": 0.5}], on_error="collect", ) for entry in batch: if entry.failure is not None: print(entry.index, entry.failure.message) else: print(entry.index, entry.result.project_file) ``` `on_error="raise"` is the default. It stops the batch on the first failed entry. With `on_error="collect"`, failed entries remain in the batch with their failure information and execution log. ## Select Working Directories For batched project keys, pass one working directory per entry: ```python batch = jcmsuite.solve( "project.jcmp", keys=[{"radius": 0.3}, {"radius": 0.4}], working_dir=["build/radius-03", "build/radius-04"], ) ``` The working-directory sequence must have the same length as the batched project keys. A one-entry batch can use one scalar working directory. For local multi-entry batches, provide one working directory per entry or set `temporary=True`. This prevents result files from different entries from sharing one result directory. Set `temporary=True` to create one temporary working directory for each batch entry when `working_dir` is not set. ## Next Steps Use [Batched Results](../../results/batched.md) to inspect entries, failures, and aligned result data. See these complete runnable tutorials: - [Run a batched solve](../../tutorials/core/solve/02_batched_solve/01_default.md). - [Collect batched failures](../../tutorials/core/solve/02_batched_solve/02_failure_collection.md). - [Set batched working directories](../../tutorials/core/solve/02_batched_solve/03_working_dir.md).