crossbar.master.cluster.routercluster

Classes

RouterClusterManager

Manages Router clusters, which runs Crossbar.io Web transport listening

RouterClusterMonitor

Background monitor running periodically in the master node to monitor, check and apply

Module Contents

class RouterClusterManager(session, globaldb, globalschema, db, schema, reactor=None)[source]

Bases: object

Manages Router clusters, which runs Crossbar.io Web transport listening endpoints on many (frontend) workers over many nodes using applying a shared, common transport definition, such as regarding the Web services configured on URL paths of the Web transport.

  • routercluster - routercluster nodes - routercluster workergroup

_PUBOPTS[source]
_monitors[source]
_mrealm_oid[source]
_personality[source]
_prefix = None[source]
_reactor[source]
_session[source]
_started = None[source]
_worker[source]
async add_routercluster_node(routercluster_oid: str, node_oid: str, config: dict | None = None, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Add a node to a router cluster. You can configure the node association for the cluster using config:

  • hardlimit: hard limit on node utilization (number of workers run on this node)

  • softlimit: soft limit on node utilization (number of workers run on this node)

Parameters:
  • routercluster_oid – OID of the router cluster to which to add the node.

  • node_oid – OID of the node to add to the cluster. A node can be added to more than one cluster.

Returns:

Added node, for example:

{
    "cluster_oid": "ad6cfb53-3712-4683-8b15-f48a6d71d410",
    "node_oid": "6009c4d1-b5e5-4ca8-aee3-0da28b5a08b2",
    "hardlimit": null,
    "softlimit": null
}

async add_routercluster_workergroup(routercluster_oid: str, workergroup: dict, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Add a Router worker group to a Router cluster. The workergroup can be configured:

{
    "name": "mygroup1",
    "scale": 4
}
Parameters:
  • routercluster_oid – Router cluster to which to add the router worker group.

  • workergroup – Web service definition object.

Returns:

Router cluster worker group creation information, for example:

{
    "changed": 1598452531613401997,
    "cluster_oid": "b99833d5-0f03-4759-b1ed-b7059e81b2d8",
    "description": null,
    "label": null,
    "name": "mygroup1",
    "oid": "5c295684-7f7f-4560-b175-7466ed957c2e",
    "scale": 4,
    "status": "STOPPED",
    "tags": null
}

async create_routercluster(routercluster: dict, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Create a new router cluster definition.

Procedure:

crossbarfabriccenter.mrealm.cluster.create_routercluster URI of WAMP procedure to call.

Event:

crossbarfabriccenter.mrealm.cluster.on_routercluster_created WAMP event published once the router cluster has been created.

Error:

wamp.error.invalid_configuration WAMP error returned when the router cluster configuration provided has a problem.

Error:

wamp.error.not_authorized WAMP error returned when the user is currently not allowed to created (another) router cluster.

Error:

crossbar.error.already_exists WAMP error returned when a router cluster named as contained in the configuration already exists.

Parameters:

routercluster

Router cluster settings. For example:

{
    "name": "cluster5"
}

Returns:

Router cluster creation information. For example:

{
    "changed": 1598379288123799334,
    "description": null,
    "label": null,
    "name": "cluster5",
    "oid": "3eccb1fd-251b-4eda-bee9-06b3d24b1c5e",
    "owner_oid": "f1c62815-56b2-484f-bb5a-a66a788c2aff",
    "status": "STOPPED",
    "tags": null
}

db[source]
async delete_routercluster(routercluster_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Delete an existing router cluster definition. The router cluster must be in status "STOPPED".

Procedure:

crossbarfabriccenter.routercluster.delete_routercluster URI of WAMP procedure to call.

Event:

crossbarfabriccenter.routercluster.on_routercluster_deleted WAMP event published once the router cluster has been deleted.

Error:

wamp.error.invalid_argument WAMP error returned when routercluster_oid was invalid.

Error:

crossbar.error.no_such_object WAMP error returned when routercluster_oid was not found.

Error:

crossbar.error.not_stopped WAMP error returned when router cluster is not in status STOPPED.

Parameters:

routercluster_oid – OID of the router cluster to delete

Returns:

Deleted router cluster, for example:

{
    "changed": 1598380973225053489,
    "description": null,
    "label": null,
    "name": "cluster5",
    "oid": "3eccb1fd-251b-4eda-bee9-06b3d24b1c5e",
    "owner_oid": "f1c62815-56b2-484f-bb5a-a66a788c2aff",
    "status": "STOPPED",
    "tags": null
}

gdb[source]
get_routercluster(routercluster_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Return configuration and run-time status information for a router cluster (by object ID).

Parameters:

routercluster_oid – Object ID of the router cluster to return.

Returns:

Router cluster definition. For example, initially, after a router cluster has been created:

{
    "changed": 1598273658338443875,
    "description": null,
    "label": null,
    "name": "cluster2",
    "oid": "634e0725-df03-4daf-becd-1de60dd2b0b3",
    "status": "STOPPED",
    "tags": null
}

get_routercluster_by_name(routercluster_name: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Return configuration and run-time status information for a router cluster (by name).

See also the corresponding procedure crossbar.master.cluster.routercluster.RouterClusterManager.get_routercluster() which returns the same information, given and object ID rather than name.

Parameters:

routercluster_name – Name of the router cluster to return.

Returns:

Router cluster definition.

get_routercluster_node(routercluster_oid: str, node_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Get information (such as for example parallel degree) for the association of a node with a routercluster.

Parameters:
  • routercluster_oid – The router cluster to which the node was added.

  • node_oid – The node to return.

Returns:

Information for the association of the node with the routercluster. For example:

{
    "cluster_oid": "ad6cfb53-3712-4683-8b15-f48a6d71d410",
    "node_oid": "d87b502c-83d9-4cce-87be-0bb1bbd9539a",
    "hardlimit": null,
    "softlimit": null
}

get_routercluster_workergroup(routercluster_oid: str, workergroup_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Get definition of a router worker group in a cluster by ID.

Parameters:
  • routercluster_oid – The router cluster running the router worker group to return.

  • workergroup_oid – The router worker group to return.

Returns:

The router cluster worker group, for example:

{
    "changed": 1598452531613401997,
    "cluster_oid": "b99833d5-0f03-4759-b1ed-b7059e81b2d8",
    "description": null,
    "label": null,
    "name": "mygroup1",
    "oid": "5c295684-7f7f-4560-b175-7466ed957c2e",
    "scale": 4,
    "status": "STOPPED",
    "tags": null
}

get_routercluster_workergroup_by_name(routercluster_name: str, workergroup_name: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Get definition of a router worker group in a cluster by name.

See also crossbar.master.cluster.routercluster.RouterClusterManager.get_routercluster_workergroup().

Parameters:
  • routercluster_name – The router cluster running the router worker group to return.

  • workergroup_name – The router worker group to return.

Returns:

The router cluster worker group.

gschema[source]
list_routercluster_nodes(routercluster_oid: str, return_names: bool | None = None, filter_by_status: str | None = None, details: autobahn.wamp.types.CallDetails | None = None) List[str][source]

List nodes currently associated with the given router cluster.

Parameters:
  • routercluster_oid – The router cluster to list nodes for.

  • return_names – Return routercluster names instead of object IDs

  • filter_by_status – Filter nodes by this status, eg. "online".

Returns:

List of node IDs of nodes associated with the router cluster. For example:

[
    "0afb5897-d8da-433a-9214-ed64e8da50b9",
    "2f656d47-5251-44bb-a507-6cebc533eb50",
    "7ddf39c5-6752-4467-9497-3f1758b2ac5e",
    "879d05f3-e3d3-4bce-894e-a281e4782a0b"
]

or with return_names set:

[
    "node1",
    "node2",
    "node3",
    "node4"
]

list_routercluster_workergroups(routercluster_oid: str, return_names: bool | None = None, filter_by_status: str | None = None, details: autobahn.wamp.types.CallDetails | None = None) List[str][source]

List worker groups in a router cluster. Detail information for a router cluster worker group can be retrieved using crossbar.master.cluster.routercluster.RouterClusterManager.get_routercluster_workergroup().

Parameters:
  • routercluster_oid – The object ID of the router cluster to list router worker groups for.

  • return_names – If set, return router worker group names instead of object IDs.

  • filter_by_status – If set, only return worker group in this status.

Returns:

List of router cluster worker group object IDs, for example:

[
    "5c295684-7f7f-4560-b175-7466ed957c2e"
]

or with return_names set:

[
    "mygroup1"
]
list_routerclusters(return_names: bool | None = None, details: autobahn.wamp.types.CallDetails | None = None) List[str][source]

Returns list of router clusters defined. Detail information for a router cluster can be retrieved using crossbar.master.cluster.routercluster.RouterClusterManager.get_routercluster().

Parameters:

return_names – Return router clusters names instead of object IDs.

Returns:

List of router clusters object IDs or names. For example:

[
    "634e0725-df03-4daf-becd-1de60dd2b0b3",
    "7dc55a4e-e52a-4bea-a8b4-daf869cc417f"
]

or with return_names set:

[
    "cluster1"
]

log[source]
async remove_routercluster_node(routercluster_oid: str, node_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Remove a node from a router cluster.

Parameters:
  • routercluster_oid – OID of the router cluster from which to remove the node.

  • node_oid – OID of the node to remove from the router cluster

Returns:

Node removed from router cluster, for example:

{
    "cluster_oid": "ad6cfb53-3712-4683-8b15-f48a6d71d410",
    "node_oid": "6009c4d1-b5e5-4ca8-aee3-0da28b5a08b2",
    "hardlimit": null,
    "softlimit": null
}

async remove_routercluster_workergroup(routercluster_oid: str, workergroup_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Remove a router worker group from a router cluster.

Parameters:
  • routercluster_oid – The object ID of the router cluster to remove a router worker group from.

  • workergroup_oid – The object ID of the router worker group to remove.

Returns:

Removed router worker group, for example:

{
    "changed": 1598455166431307344,
    "cluster_oid": "b99833d5-0f03-4759-b1ed-b7059e81b2d8",
    "description": null,
    "label": null,
    "name": "mygroup1",
    "oid": "fa5498b7-c660-4a5b-81f5-95f9223a19f5",
    "scale": 4,
    "status": "STOPPED",
    "tags": null
}

schema[source]
start(prefix)[source]

Start this router cluster manager, including all monitors of router clusters defined.

Returns:

async start_routercluster(routercluster_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Start a router cluster

Parameters:

routercluster_oid – Object ID of router cluster to start.

Returns:

Started router cluster, for example:

{
    "changed": 1598402748823470105,
    "oid": "ad6cfb53-3712-4683-8b15-f48a6d71d410",
    "status": "STARTING",
    "who": {
        "authid": "superuser",
        "authrole": "owner",
        "session": 6761363113437744
    }
}

stat_routercluster(routercluster_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

NOT YET IMPLEMENTED

Get current status and statistics for given router cluster.

Parameters:

routercluster_oid – The router cluster to return status and statistics for.

Returns:

Current status and statistics for given router cluster.

stat_routercluster_workergroup(routercluster_oid: str, workergroup_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

NOT YET IMPLEMENTED

Return current status and statistics for the router worker group.

Parameters:
  • routercluster_oid – The router cluster running the web service to return status and statistics for.

  • workergroup_oid – The worker group to return status and statistics for.

Returns:

Current status and statistics information for the router worker group.

stop()[source]

Stop the currently running router cluster manager. This will stop all monitors for router clusters.

Returns:

async stop_routercluster(routercluster_oid: str, details: autobahn.wamp.types.CallDetails | None = None) dict[source]

Stop a running router cluster.

Parameters:

routercluster_oid – Object ID of router cluster to stop.

Returns:

Stopped router cluster, for example:

{
    "changed": 1598402964397396934,
    "oid": "ad6cfb53-3712-4683-8b15-f48a6d71d410",
    "status": "STOPPING",
    "who": {
        "authid": "superuser",
        "authrole": "owner",
        "session": 8299909547427073
    }
}

class RouterClusterMonitor(manager, routercluster_oid, interval=10.0)[source]

Bases: object

Background monitor running periodically in the master node to monitor, check and apply necessary actions for router clusters.

The monitor is started when a router cluster is started.

_check_and_apply()[source]
_check_and_apply_in_progress = False[source]
_interval = 10.0[source]
_loop = None[source]
_manager[source]
_routercluster_oid[source]
property is_started[source]

return:

log[source]
start()[source]
Returns:

stop()[source]
Returns: