crossbar.common.process¶
Attributes¶
Classes¶
Manhole service running inside a native processes (controller, router, container). |
|
A native Crossbar.io process (currently: controller, router or container). |
Module Contents¶
- class ManholeService(config, who)[source]¶
Bases:
objectManhole service running inside a native processes (controller, router, container).
This class is for _internal_ use within NativeProcess.
- class NativeProcess(config=None, reactor=None, personality=None)[source]¶
Bases:
autobahn.twisted.wamp.ApplicationSessionA native Crossbar.io process (currently: controller, router or container).
- get_cpu_count(logical=True, details=None)[source]¶
Returns the CPU core count on the machine this process is running on.
- get_manhole(details=None)[source]¶
Get current manhole service information.
- Returns:
A dict with service information or None if the service is not running.
- get_process_info(details=None)[source]¶
Get process information (open files, sockets, …).
- Returns:
Dictionary with process information.
- get_process_stats(details=None)[source]¶
Get process statistics (CPU, memory, I/O).
- Returns:
Dictionary with process statistics.
- set_process_stats_monitoring(interval, details=None)[source]¶
Enable/disable periodic publication of process statistics.
- Parameters:
interval (float) – The monitoring interval in seconds. Set to 0 to disable monitoring.
- start_manhole(config, details=None)[source]¶
Start a Manhole service within this process.
Usage:
This procedure is registered under
crossbar.node.<node_id>.worker.<worker_id>.start_manhole- for native workerscrossbar.node.<node_id>.controller.start_manhole- for node controllers
The procedure takes a Manhole service configuration which defines a listening endpoint for the service and a list of users including passwords, e.g.
{ "endpoint": { "type": "tcp", "port": 6022 }, "users": [ { "user": "oberstet", "password": "secret" } ] }
Errors:
The procedure may raise the following errors:
crossbar.error.invalid_configuration- the provided configuration is invalidcrossbar.error.already_started- the Manhole service is already running (or starting)crossbar.error.feature_unavailable- the required support packages are not installed
Events:
The procedure will publish an event when the service is starting to
crossbar.node.<node_id>.worker.<worker_id>.on_manhole_starting- for native workerscrossbar.node.<node_id>.controller.on_manhole_starting- for node controllers
and publish an event when the service has started to
crossbar.node.<node_id>.worker.<worker_id>.on_manhole_started- for native workerscrossbar.node.<node_id>.controller.on_manhole_started- for node controllers
- Parameters:
config (dict) – Manhole service configuration.
- started(details=None)[source]¶
Return start time of this process.
Usage:
This procedure is registered under
crossbar.node.<node_id>.worker.<worker_id>.startedfor native workers and undercrossbar.node.<node_id>.controller.startedfor node controllers
- Returns:
Start time (UTC) in UTC ISO 8601 format.
- Return type:
- stop_manhole(details=None)[source]¶
Stop the Manhole service running in this process.
This procedure is registered under
crossbar.node.<node_id>.worker.<worker_id>.stop_manholefor native workers and undercrossbar.node.<node_id>.controller.stop_manholefor node controllers
When no Manhole service is currently running within this process, or the Manhole service is already shutting down, a
crossbar.error.not_startedWAMP error is raised.The procedure will publish an event when the service is stopping to
crossbar.node.<node_id>.worker.<worker_id>.on_manhole_stoppingfor native workers andcrossbar.node.<node_id>.controller.on_manhole_stoppingfor node controllers
and will publish an event when the service has stopped to
crossbar.node.<node_id>.worker.<worker_id>.on_manhole_stoppedfor native workers andcrossbar.node.<node_id>.controller.on_manhole_stoppedfor node controllers
- trigger_gc(details=None)[source]¶
Manually trigger a garbage collection in this native process.
This procedure is registered under
crossbar.node.<node_id>.worker.<worker_id>.trigger_gcfor native workers and undercrossbar.node.<node_id>.controller.trigger_gcfor node controllers.The procedure will publish an event when the garabage collection has finished to
crossbar.node.<node_id>.worker.<worker_id>.on_gc_finishedfor native workers andcrossbar.node.<node_id>.controller.on_gc_finishedfor node controllers:{ "requester": { "session_id": 982734923, "auth_id": "bob", "auth_role": "admin" }, "duration": 190 }
Note
The caller of this procedure will NOT receive the event.
- Returns:
Time (wall clock) consumed for garbage collection in ms.
- Return type:
- uptime(details=None)[source]¶
Return uptime of this process.
Usage:
This procedure is registered under
crossbar.node.<node_id>.worker.<worker_id>.uptimefor native workers and undercrossbar.node.<node_id>.controller.uptimefor node controllers
- Returns:
Uptime in seconds.
- Return type:
- utcnow(details=None)[source]¶
Return current time as determined from within this process.
Usage:
This procedure is registered under
crossbar.node.<node_id>.worker.<worker_id>.utcnowfor native workers and undercrossbar.node.<node_id>.controller.utcnowfor node controllers
- Returns:
Current time (UTC) in UTC ISO 8601 format.
- Return type: