Skip to content

sim2bot.shutdown_managed_bridges

shutdown_managed_bridges() -> None

Terminate bridge processes started by ensure_bridge in this process.

Bridges that were already running and merely discovered are not stopped.

Returns:

  • None

    Already-running bridges not owned by this process remain active.

Source code in sim2bot/bridge.py
def shutdown_managed_bridges() -> None:
    """Terminate bridge processes started by
    [`ensure_bridge`][sim2bot.bridge.ensure_bridge] in this process.

    Bridges that were already running and merely discovered are not stopped.

    Returns:
        Already-running bridges not owned by this process remain active.
    """
    for process in list(_managed_processes):
        _terminate_process(process)
    _managed_processes.clear()

Practical examples

Examples use objects discovered from the current scene rather than hard-coded robot metadata.

Explicit cleanup

from sim2bot import ensure_bridge, shutdown_managed_bridges

ensure_bridge()
shutdown_managed_bridges()

Clean up after a test session

try:
    run_bridge_integration_tests()
finally:
    shutdown_managed_bridges()

Guidance

Usage tip

Normal interpreter shutdown already cleans up managed bridges; explicit cleanup is useful in tests and long-running hosts.

Common error

A bridge that was already running before ensure_bridge() is not owned and will not be stopped.


See also