boss

Submodules

Classes

BOSS

Use the communication between two processes via a pipe to implement RPC.

Package Contents

class boss.BOSS(name: str, configs: list, loop: asyncio.AbstractEventLoop, realm: str, remote_pipe=None)[source]

Bases: boss.multiprocess.MultiprocessRPC

Use the communication between two processes via a pipe to implement RPC.

In BOSS this is used to communicate between the BOSS object in the main process and the BOSSRemote running in a separate process. This becomes necessary since zenoh/rust/pyO3 does not allow to run in the main process and in dynamically generated processes.

hero_config_sources: list
name
heros: dict
workers: dict
_loop
realm
_config_from_name(name)[source]
add_hero_source(parser: collections.abc.Callable[[str], boss.configuration.WorkerConfigurationDocument], target: str)[source]

Adds a data source to the BOSS from which HERO configurations are loaded.

Parameters:
  • parser – A function which takes target as an argument and returns a boss.configuration.WorkerConfigurationDocument dict with the HERO config information.

  • target – Target for the parser, for example an URL for boss.configuration.WorkerConfigurationDocument.parse_url()

refresh_hero_sources(auto_start: bool = True)[source]

Refresh the HERO configuration data from the registered sources, updating existing HEROs, adding new ones, and removing those that are no longer present in the sources. HEROs that were running before are only restarted if their configuration changed. HEROs without configuration changes stay untouched.

Parameters:

auto_start – If True, automatically starts a new hero source if its configuration is loaded. Defaults to True. Does not influence the behavior of HEROs that are already registered.

add_hero(config: boss.configuration.WorkerConfigurationDocument | dict, auto_start: bool = True)[source]

Start a new HERO and keep it running. Note that the id of the HERO specified in the config must be unique.

Parameters:
  • config – configuration for the new HERO. If a dict is given, it is converted into a WorkerConfigurationDocument.

  • auto_start – If true the new HERO is immediately started after adding

start_hero(name)[source]

Start HERO with given name.

stop_hero(name: str)[source]
restart_hero(name: str)[source]
remove_hero(name: str)[source]
start_all()[source]
stop_all()[source]
status()[source]