better_launch.elements.node module

class better_launch.elements.node.Node(package: str, executable: str, name: str, namespace: str, *, remaps: dict[str, str] = None, params: str | dict[str, Any] = None, cmd_args: list[str] = None, env: dict[str, str] = None, isolate_env: bool = False, log_level: int = 20, output: Literal['screen', 'log', 'own_log', 'none'] | set[Literal['screen', 'log', 'own_log', 'none']] = 'screen', on_exit: Callable = None, max_respawns: int = 0, respawn_delay: float = 0.0, use_shell: bool = False, raw: bool = False)

Bases: AbstractNode, LiveParamsMixin

property is_running: bool

True if the node is currently running.

join(timeout: float = None) int

Wait for the underlying process to terminate and return its exit code. Returns immediately if the process is not running.

Parameters

timeoutfloat, optional

How long to wait for the process to finish. Wait forever if None.

Returns

int

The exit code of the process, or None if it is already terminated.

Raises

TimeoutError

If a timeout was specified and the process is still running by the time the timeout expires.

property pid: int

The process ID of the node process. Will be -1 if the process is not running.

shutdown(reason: str, signum: int = Signals.SIGTERM, timeout: float = 0.0) None

Shutdown this node. Once this succeeds, is_running() will return False.

Parameters

reasonstr

A human-readable string describing why this node is being shutdown.

signumint, optional

The signal that should be send to the node (if supported).

timeoutfloat, optional

How long to wait for the node to shutdown before returning. Don’t wait if timeout is 0.0. Wait forever if timeout is None.

Raises

TimeoutError

If a timeout > 0 was set and the node did not shutdown before then.

start() None

Start this node. Once this succeeds, is_running() will return True.