boss
====

.. py:module:: boss


Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/boss/boss/index
   /autoapi/boss/configuration/index
   /autoapi/boss/container/index
   /autoapi/boss/dummies/index
   /autoapi/boss/factory/index
   /autoapi/boss/helper/index
   /autoapi/boss/starter/index


Classes
-------

.. autoapisummary::

   boss.BOSS


Package Contents
----------------

.. py:class:: BOSS(name: str, configs: list, loop: asyncio.AbstractEventLoop, pool: concurrent.futures.ProcessPoolExecutor, realm: str, expose: bool = True)

   .. py:attribute:: hero_config_sources
      :type:  list


   .. py:attribute:: name


   .. py:attribute:: heros
      :type:  dict


   .. py:attribute:: _loop


   .. py:attribute:: _pool


   .. py:attribute:: realm


   .. py:method:: _config_from_name(name)


   .. py:method:: add_hero_source(parser: collections.abc.Callable[[str], boss.configuration.WorkerConfigurationDocument], target: str)

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

      :param parser: A function which takes :code:`target` as an argument and returns a
                     :py:class:`boss.configuration.WorkerConfigurationDocument` dict with the HERO config information.
      :param target: Target for the :code:`parser`, for example an URL for
                     :py:meth:`boss.configuration.WorkerConfigurationDocument.parse_url`



   .. py:method:: refresh_hero_sources(auto_start: bool = True)

      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.

      :param 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.



   .. py:method:: add_hero(config: boss.configuration.WorkerConfigurationDocument | dict, auto_start: bool = True)

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

      :param config: configuration for the new HERO. If a dict is given, it is converted into
                     a WorkerConfigurationDocument.
      :param auto_start: If true the new HERO is immediately started after adding



   .. py:method:: start_hero(name)

      Start HERO with given name.



   .. py:method:: stop_hero(name: str)


   .. py:method:: restart_hero(name: str)


   .. py:method:: remove_hero(name: str)


   .. py:method:: start_all()


   .. py:method:: stop_all()


   .. py:method:: status()


