crossbar.worker.controller

Classes

WorkerController

A native Crossbar.io worker process. The worker will be connected

Module Contents

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

Bases: crossbar.common.process.NativeProcess

A native Crossbar.io worker process. The worker will be connected to the node’s management router running inside the node controller via WAMP-over-stdio.

WORKER_TYPE = 'native'[source]
_release_pubkey[source]
add_pythonpath(paths, prepend=True, details=None)[source]

Add paths to Python module search paths.

This procedure is registered under WAMP URI crossbar.worker.<worker_id>.add_pythonpath.

Parameters:
  • paths (list[str]) – List of paths. Relative paths will be resolved relative to the node directory.

  • prepend (bool) – If True, prepend the given paths to the current paths. Otherwise append.

get_controller_session() crossbar.interfaces.ISession[source]

Implements :method:`crossbar.interfaces.IRealmContainer.get_controller_session`.

get_node_id(details=None)[source]
get_profile(profile_id, details=None)[source]

Get a profile previously produced by a profiler run.

This procedure is registered under WAMP URI crossbar.worker.<worker_id>.get_profile.

When no profile with given ID exists, a WAMP error crossbar.error.no_such_object is raised.

get_profilers(details=None)[source]

Registered under: crossbar.worker.<worker_id>.get_profilers

Returns available profilers.

Parameters:

details (autobahn.wamp.types.CallDetails) – WAMP call details (auto-filled by WAMP).

Returns:

A list of profilers.

Return type:

list[str]

get_public_key()[source]

Call into node controller (over secure controller-worker pipe) to get the node’s public key.

Returns:

get_pythonpath(details=None)[source]

Returns the current Python module search paths.

This procedure is registered under WAMP URI crossbar.worker.<worker_id>.get_pythonpath.

Returns:

The current module search paths.

Return type:

list[str]

log[source]
onConnect()[source]

Called when the worker has connected to the node’s management router.

onDisconnect()[source]

Implements autobahn.wamp.interfaces.ISession.onDisconnect()

onJoin(details, publish_ready=True)[source]

Called when worker process has joined the node management realm.

onLeave(details)[source]

Implements autobahn.wamp.interfaces.ISession.onLeave()

publish_ready()[source]
set_node_id(node_id, details=None)[source]
shutdown(details=None)[source]

Registered under: crossbar.worker.<worker_id>.shutdown Event published under: crossbar.worker.<worker_id>.on_shutdown_requested

sign_challenge(challenge: autobahn.wamp.types.Challenge, channel_id: bytes | None, channel_id_type=Optional[str])[source]

Call into node controller (over secure controller-worker pipe) to sign challenge with node key.

Parameters:
  • challenge

  • channel_id

  • channel_id_type

Returns:

start_profiler(profiler='vmprof', runtime=10, start_async=True, details=None)[source]

Registered under: crossbar.worker.<worker_id>.start_profiler

Start a profiler producing a profile which is stored and can be queried later.

Parameters:
  • profiler (str) – The profiler to start, e.g. vmprof.

  • runtime (float) – Profiling duration in seconds.

  • start_async (bool) – Flag to turn on/off asynchronous mode.

  • details (autobahn.wamp.types.CallDetails) – WAMP call details (auto-filled by WAMP).

Returns:

If running in synchronous mode, the profiling result. Else a profile ID is returned which later can be used to retrieve the profile.

Return type:

dict or int

templates() jinja2.Environment[source]

Jinja2 rendering environment.

Returns:

jinja2.Environment for the built-in templates from personality.TEMPLATE_DIRS

property templates_dir: List[str][source]

Template directories used in the Jinja2 rendering environment.

Returns: