Submit And Wait

Set dispatch="submit" to submit solve work without waiting for completion. solve returns a submission handle.

Call the submission’s wait() method to collect the solve result.

Use this page when the solve must continue while your code performs other operations. For one immediate result, omit dispatch="submit" and use the normal solve call.

import jcmsuite

with jcmsuite.daemon.handler() as daemon:
    submission = jcmsuite.solve(
        "project.jcmp",
        dispatch="submit",
    )

    # Other operations

    result = submission.wait()

Alternatively, call wait() on the DaemonHandler with the submission.

import jcmsuite

with jcmsuite.daemon.handler() as daemon:
    submission = jcmsuite.solve(
        "project.jcmp",
        dispatch="submit",
    )

    # Other operations

    result = daemon.wait(submission)

The wait operation collects the final result and attaches the daemon execution log to the SolveResult.

Submit A Batch

Pass batched project keys to submit several solve entries:

with jcmsuite.daemon.handler() as daemon:
    submission = jcmsuite.solve(
        "project.jcmp",
        keys=[{"radius": 0.3}, {"radius": 0.4}, {"radius": 0.5}, {"radius": 0.6}],
        dispatch="submit",
    )

    # Other operations

    batch = submission.wait()

solve returns a BatchSolveSubmission in input order. Its wait operation returns a BatchSolveResult.

BatchSolveSubmission supports slicing. A slice selects a subset of the original submission, and its wait operation returns a BatchSolveResult for that subset. You can collect one subset and then another subset later.

with jcmsuite.daemon.handler() as daemon:
    submission = jcmsuite.solve(
        "project.jcmp",
        keys=[{"radius": 0.3}, {"radius": 0.4}, {"radius": 0.5}, {"radius": 0.6}],
        dispatch="submit",
    )

    first_half = submission[:2]
    first_batch = first_half.wait()

    # Other operations

    second_half = submission[2:]
    second_batch = second_half.wait()

Ordered project bundles and batches of ordered project bundles also support dispatch="submit". See Ordered project bundles for the input shapes.

Control Collection

Use these wait() options to collect submitted work. For a batch submission, the returned BatchSolveResult contains the entries collected under the selected policy.

Option

Values

Effect

break_when

"all" or "any"

Wait for all requested submissions, or return after the first requested submission finishes.

timeout

Seconds or None

Stop waiting after the specified duration. None means no timeout. The return policy can provide a partial result.

on_timeout

"raise" or "return"

Raise on timeout, or return the entries available before the time limit.

on_error

"raise" or "collect"

Raise on a failed batch entry, or retain it as structured BatchSolveFailure information.

progress

True or False

Show a progress indicator while collecting a batch.

progress_label

String or None

Specify the text for the progress indicator.

For example:

batch = submission.wait(
    break_when="any",
    timeout=60,
    on_timeout="return",
    on_error="collect",
    progress=True,
)

If on_timeout="raise" or on_error="raise" is selected, the wait operation raises instead of returning the partial or failed batch result. If on_timeout="return" is selected, inspect the returned entries before you use their results.

Inspect Or Close Submissions

Use daemon.jobs.info() to request information for all tracked submissions. Pass job_id values to select a subset.

Use daemon.jobs.kill() to close tracked submissions and release local tracking state. Pass job_id values to close selected submissions. Omit the argument to close all tracked submissions:

closed_ids = daemon.jobs.kill([submission.job_id])

submission behavior applies to Batched Solves and Ordered project bundles. See Async Execution for async behavior across direct solves and daemon submission. See the Submit And Collect Daemon Work tutorial for a runnable partial-collection workflow.