HubClient#

class cegalprizm.hub.HubClient(connection_parameters: Optional[cegalprizm.hub.connection_parameters.ConnectionParameters] = None, token_provider=None)#

A convenience utility class for making GRPC unary, client and server streaming requests to Cegal Hub Connectors via a running Cegal Hub Server.

Parameters

HubChannel (HubChannel) – Extends HubChannel which provides logic for setting up a GRPC channel

Create a HubClient utility object for making Cegal Hub Connector requests via a Cegal Hub Server.

Parameters
  • connection_parameters (ConnectionParameters, optional) – The configuration details to communicate with a running Cegal Hub Server. Defaults to None.

  • token_provider – Most often an OidcClient object. Defaults to None.

close()#

Close the underlying GRPC channel.

do_client_streaming(wellknown_connector_identifier: str, wellknown_payload_identifier: str, iterable_payloads: Iterable, connector_filter: Optional[cegalprizm.hub.connector_filter.ConnectorFilter] = None, major_version: int = 0, minor_version: int = 0)#

Make a client streaming GRPC client request against a wellknown Cegal Hub Connector type and wellknown payload identifier via a running Cegal Hub Server.

Parameters
  • wellknown_connector_identifier (str) – The wellknown identifier of a Cegal Hub Connector type such as cegal.hub.agent or cegal.hub.petrel

  • wellknown_payload_identifier (str) – The wellknown payload identifier (functionality supported by the Cegal Hub Connector) such as cegal.hub.agent.list_files

  • iterable_payloads (Iterable) – The client payloads to stream to the Cegal Hub Connector

  • major_version (int) – The major version number for the payload

  • minor_version (int) – The minor version number for the payload

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

Returns

A tuple containing a success / failure bool, the result Any payload and the connector instance identifier str that handled the request

Return type

tuple

Yields

[type] – [description]

do_server_streaming(wellknown_connector_identifier: str, wellknown_payload_identifier: str, payload, connector_filter: Optional[cegalprizm.hub.connector_filter.ConnectorFilter] = None, major_version: int = 0, minor_version: int = 0)#

Make a server streaming GRPC client request against a wellknown Cegal Hub Connector type and wellknown payload identifier via a running Cegal Hub Server.

Parameters
  • wellknown_connector_identifier (str) – The wellknown identifier of a Cegal Hub Connector type such as cegal.hub.agent or cegal.hub.petrel

  • wellknown_payload_identifier (str) – The wellknown payload identifier (functionality supported by the Cegal Hub Connector) such as cegal.hub.agent.list_files

  • payload (Any) – A protobuf Any object

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

  • major_version (int) – The major version number for the payload

  • minor_version (int) – The minor version number for the payload

Yields

tuple – A tuple containing a success / failure bool, the result Any payload and the connector instance identifier str that handled the request

do_unary_request(wellknown_connector_identifier, wellknown_payload_identifier, payload, connector_filter: Optional[cegalprizm.hub.connector_filter.ConnectorFilter] = None, major_version: int = 0, minor_version: int = 0)#

Make a unary GRPC client request against a wellknown Cegal Hub Connector type and wellknown payload identifier via a running Cegal Hub Server.

Parameters
  • wellknown_connector_identifier (str) – The wellknown identifier of a Cegal Hub Connector type such as cegal.hub.agent or cegal.hub.petrel

  • wellknown_payload_identifier (str) – The wellknown payload identifier (functionality supported by the Cegal Hub Connector) such as cegal.hub.agent.list_files

  • payload (Any) – A protobuf Any object

  • major_version (int) – The major version number for the payload

  • minor_version (int) – The minor version number for the payload

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

Returns

A tuple containing a success / failure bool, the result Any payload and the connector instance identifier str that handled the request

Return type

tuple

property channel#

The GRPC channel associated with a running Cegal Hub Server.

Returns

The GRPC channel associated with a running Cegal Hub Server.

Return type

Channel

property connection_parameters#

The ConnectionParameters object associated with the running Cegal Hub Server.

Returns

The ConnectionParameters object associated with the running Cegal Hub Server.

Return type

ConnectionParameters

property connector_request_stub#

The service stub for clients to communicate with Cegal Hub Connectors

Returns

The service stub for clients to communicate with Cegal Hub Connectors

Return type

ConnectorRequestServiceStub

property server_request_stub#

The service stuf stub for clients to communicate with a Cegal Hub Server

Returns

The service stuf stub for clients to communicate with a Cegal Hub Server

Return type

ServerServiceStub

property token_provider#

The token provider associated with authenticating against a Cegal Hub Server.

Returns

Usually an OidcClient.

Return type

token_provider