crossbar.worker.container

Classes

ContainerController

A container is a native worker process that hosts application components

Module Contents

class ContainerController(config=None, reactor=None, personality=None)[source]

Bases: crossbar.worker.controller.WorkerController

A container is a native worker process that hosts application components written in Python. A container connects to an application router (creating a WAMP transport) and attached to a given realm on the application router.

RESTART_ALWAYS = 'restart-always'[source]
RESTART_FAILED = 'restart-failed'[source]
RESTART_NEVER = 'restart-never'[source]
SHUTDOWN_MANUAL = 'shutdown-manual'[source]
SHUTDOWN_ON_ANY_COMPONENT_FAILED = 'shutdown-on-any-component-failed'[source]
SHUTDOWN_ON_ANY_COMPONENT_STOPPED = 'shutdown-on-any-component-stopped'[source]
SHUTDOWN_ON_LAST_COMPONENT_STOPPED = 'shutdown-on-last-component-stopped'[source]
WORKER_TITLE = 'Container'[source]
WORKER_TYPE = 'container'[source]
_exit_mode[source]
_publish_component_stop(component)[source]

Internal helper to publish details to on_component_stop

_restart_mode[source]
components[source]
components_shared[source]
get_component(component_id, details=None)[source]

Get a component currently running within this container.

Parameters:
Returns:

Component detail information.

Return type:

dict

get_components(details=None)[source]

Get components currently running within this container.

Parameters:
Returns:

Plain (sorted) list of component IDs, or list of components sorted by component ID when ids_only==True.

Return type:

list

onJoin(details)[source]

Called when worker process has joined the node’s management realm.

restart_component(component_id, reload_modules=False, details=None)[source]

Restart a component currently running within this container using the same configuration that was used when first starting the component.

Parameters:
  • component_id (str) – The ID of the component to restart.

  • reload_modules (bool) – If True, enforce reloading of modules (user code) that were modified (see: TrackingModuleReloader).

  • details (instance of autobahn.wamp.types.CallDetails) – Caller details.

:returns dict – A dict with combined info from component stopping/starting.

shutdown(details=None)[source]

Stops the whole container gracefully by stopping all components currently running, and then stopping the container worker.

Note: This behaves more gracefully than stopping the container from outside, using “stop_worker”, and also returns the stopped components.

Returns:

List of IDs of the components stopped (if any) while shutting down.

Return type:

list of str

start_component(component_id, config, reload_modules=False, details=None)[source]

Starts a component in this container worker.

Parameters:
  • component_id (str) – The ID under which to start the component.

  • config (dict) – Component configuration.

  • reload_modules (bool) – If True, enforce reloading of modules (user code) that were modified (see: TrackingModuleReloader).

  • details (instance of autobahn.wamp.types.CallDetails) – Caller details.

Returns:

Component startup information.

Return type:

dict

stop_component(component_id, details=None)[source]

Stop a component currently running within this container.

Parameters:
Returns:

Stop information.

Return type:

dict