Skip to main content
Source: src/cwsandbox/init.py:121
Wait for waitables to complete, and return a (done, pending) tuple. Each waitable type has a natural “wait for” behavior:
  • Sandbox: waits until the status is RUNNING.
  • OperationRef: waits until the operation completes.
  • Process: waits until the process completes.
Parameters
  • waitables (Sequence[Waitable]): A sequence of Sandbox, OperationRef, or Process objects.
  • num_returns (int | None): If specified, returns after this many waitables complete. If None, waits for all to complete.
  • timeout (float | None): The maximum number of seconds to wait. If None, waits indefinitely.
Returns
  • tuple[list[Waitable], list[Waitable]]: A tuple of (done, pending) lists containing the original waitable objects.
Raises
  • ValueError: If num_returns is less than 1.
Examples Wait for all sandboxes to be running:
Wait for the first two operations to complete:
Wait with a timeout:
Last modified on May 29, 2026