Batched Solves

Use batched solves to run one project with batched project keys. The project keys are processed in input order.

Run Batched Project Keys

Pass batched project keys to keys=:

import jcmsuite

batch = jcmsuite.solve(
    "project.jcmp",
    keys=[
        {"radius": 0.3},
        {"radius": 0.4},
        {"radius": 0.5},
    ],
    temporary=True,
)

The call returns a BatchSolveResult. The entry at 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:

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:

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 to inspect entries, failures, and aligned result data.

See these complete runnable tutorials: