Hub#

class cegalprizm.hub.Hub(connection_parameters: Optional[cegalprizm.hub.connection_parameters.ConnectionParameters] = None)#

Provides access to communicate with an instance of a running Cegal Hub Server. The Cegal Hub Server may be local or remote. A Hub instance provides helper methods to make Cegal Hub Server queries and access to Cegal Hub Petrel Connectors and Cegal Hub Agent Connectors via contexts.

Creates a Hub with the specified ConnectionParameters with useful methods to obtain contexts to a Cegal Hub Agent Connector or Cegal Hub Petrel Connector and make Cegal Hub Server queries.

Parameters
  • connection_parameters (ConnectionParameters, optional) – The connection parameters which address

  • None. (a Cegal Hub Server. Defaults to) –

    Functions

    __init__([connection_parameters])

    Creates a Hub with the specified ConnectionParameters with useful methods to obtain contexts to a Cegal Hub Agent Connector or Cegal Hub Petrel Connector and make Cegal Hub Server queries.

    activate()

    Activate a running Cegal Hub Server instance.

    close()

    Close the underlying HubClient GRPC channel.

    default_agent_ctx()

    Get a default AgentContext object.

    default_petrel_ctx()

    Get a default PetrelContext object.

    is_version_compatible()

    Checks the compatibility of the Cegal Hub Python client library with the running Cegal Hub Server.

    new_agent_ctx([connector_filter])

    Create a new AgentContext.If a targeting ConnectorFilter is not provided, this will be a loose handle to all available Agent instances that the user has available.

    new_petrel_ctx([connector_filter])

    Create a new PetrelContext.

    print_query_connectors([show_meta, ...])

    Print human-friendly information about the Cegal Hub Connectors available to the user.

    print_query_server()

    Print human-friendly information about a running Cegal Hub Server.

    query_connectors([wellknown_identifier, ...])

    Query Connectors available to the user on a running Cegal Hub Server.

    query_server()

    Query a running Cegal Hub Server for information on the Hub Server.

    verify_health()

    Verify the health of a running Cegal Hub Server

activate()#

Activate a running Cegal Hub Server instance. The activation is only needed once on a running Cegal Hub Server instance. It is also only needed if the Cegal Hub is running in Server mode.

Returns

An object representing the result of the activation.

Return type

ActivateServerResult

close()#

Close the underlying HubClient GRPC channel.

default_agent_ctx()#

Get a default AgentContext object. If the user has several AgentContext objects available it will arbitrarily select the first instance. This AgentContext will be a strong handle to a specific Agent instance.

Raises

Exception – If no Agent instances are connected to Hub Server or are not available to the user.

Returns

A strong handle to a running instance of an Agent connected to Hub Server.

Return type

AgentContext

default_petrel_ctx()#

Get a default PetrelContext object. If the user has several PetrelContext objects available it will arbitrarily select the first instance. This PetrelContext will be a strong handle to a specific Petrel instance.

Raises

Exception – If no Petrel instances are connected to the Hub Server or are not available to the user.

Returns

A strong handle to a running instance of Petrel connected to Hub Server.

Return type

PetrelContext

is_version_compatible()#

Checks the compatibility of the Cegal Hub Python client library with the running Cegal Hub Server.

Returns

True if compatible, False if incompatible or compatibilty cannot be determined.

Return type

bool

new_agent_ctx(connector_filter: Optional[cegalprizm.hub.connector_filter.ConnectorFilter] = None)#

Create a new AgentContext.If a targeting ConnectorFilter is not provided, this will be a loose handle to all available Agent instances that the user has available. In this scenario if multiple Agent instances are available, logical client requests will be made using a round-robin schedule.

Parameters

connector_filter (ConnectorFilter, optional) – A means to target a particular connector instance(s). Defaults to None.

Returns

A handle to one or more Agent instances.

Return type

AgentContext

new_petrel_ctx(connector_filter: Optional[cegalprizm.hub.connector_filter.ConnectorFilter] = None)#

Create a new PetrelContext. If a targeting ConnectorFilter is not provided, this will be a loose handle to all available Petrel instances that the user has available. In this scenario if multiple Petrel instances are available, logical client requests will be made using a round-robin schedule.

Parameters

connector_filter (ConnectorFilter, optional) – A means to target a particular connector instance(s). Defaults to None.

Returns

A handle to one or more Petrel instances.

Return type

PetrelContext

print_query_connectors(show_meta: bool = True, show_payloads: bool = True, show_labels: bool = True, wellknown_identifier: str = '', wellknown_payload_identifier: str = '', connector_filter: Optional[cegalprizm.hub.connector_filter.ConnectorFilter] = None)#

Print human-friendly information about the Cegal Hub Connectors available to the user.

Parameters
  • show_meta (bool, optional) – Include meta information in the output. Defaults to True.

  • show_payloads (bool, optional) – Include payload information in the output. Defaults to True.

  • show_labels (bool, optional) – Include Connector labels in the output. Defaults to True.

  • wellknown_identifier (str, optional) – Target a specific instance of a running Cegal Hub Connector with the given connector identifier. Defaults to “”.

  • wellknown_payload_identifier (str, optional) – Target specific Connectors based on the specified wellknown payload identifier. Defaults to “”.

  • connector_filter (ConnectorFilter, optional) – A ConnectorFilter object to target a specific Connector(s). Defaults to None.

Raises

Exception – If there is a problem querying the running Cegal Hub Server

print_query_server()#

Print human-friendly information about a running Cegal Hub Server.

query_connectors(wellknown_identifier='', wellknown_payload_identifier='', connector_filter: Optional[cegalprizm.hub.connector_filter.ConnectorFilter] = None)#

Query Connectors available to the user on a running Cegal Hub Server.

Parameters
  • wellknown_identifier (str, optional) – Limit the returned result to only Connectors of a given wellknown type. Defaults to “”.

  • wellknown_payload_identifier (str, optional) – Limit the return result to only include Connectors that have the specified wellknown payload. Defaults to “”.

  • connector_filter (ConnectorFilter, optional) – A ConnectorFilter object to target a specific Connector(s). Defaults to None.

Returns

An object containing information about the Cegal Hub Connectors available to the user.

Return type

ConnectorQueryResult

query_server()#

Query a running Cegal Hub Server for information on the Hub Server.

Returns

An object containing information about the running Cegal Hub Server.

Return type

ServerQueryResult

verify_health()#

Verify the health of a running Cegal Hub Server

Returns

An object containing non-sensitive open information about the Cegal Hub Server

Return type

HealthQueryResult