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.