hydrosdk.cluster module

class hydrosdk.cluster.Cluster(http_address, grpc_address=None, grpc_credentials=None, grpc_options=None, grpc_compression=None, timeout=5, check_connection=True, **kwarg)

Bases: object

Cluster responsible for interactions with the server.

Example

Parameters
  • http_address (str) –

  • grpc_address (Optional[str]) –

  • grpc_credentials (Optional[grpc.ChannelCredentials]) –

  • grpc_options (Optional[list]) –

  • grpc_compression (Optional[grpc.Compression]) –

  • timeout (int) –

Return type

Cluster

Create a cluster instance only with HTTP connection.

>>> cluster = Cluster("http-cluster-endpoint")
>>> print(cluster.build_info())

Create a cluster instance with both HTTP and gRPC connection.

>>> from grpc import ssl_channel_credentials
>>> grpc_credentials = ssl_channel_credentials()
>>> cluster = Cluster("http-cluster-endpoint", "grpc-cluster-endpoint", ssl=True, grpc_credentials=grpc_credentials)
>>> print(cluster.build_info())

A cluster object which hides networking details and provides a connection to a deployed Hydrosphere cluster.

Parameters
  • http_address (str) – HTTP endpoint of the cluster

  • grpc_address (Optional[str]) – gRPC endpoint of the cluster

  • grpc_credentials (Optional[grpc.ChannelCredentials]) – an optional instance of ChannelCredentials to use for gRPC endpoint

  • grpc_options (Optional[list]) – an optional list of key-value pairs to configure the channel

  • grpc_compression (Optional[grpc.Compression]) – an optional value indicating the compression method to be used over the lifetime of the channel

  • timeout (int) – timeout value to check for gRPC connection

Returns

Cluster instance

Return type

Cluster

build_info()

Returns Manager, Gateway and Sonar services builds information containing version, release commit, etc.

Returns

Dictionary with build information

Return type

Dict[str, str]

request(method, url, **kwargs)

Formats address and url, send request

Parameters
  • method (str) – type of request

  • url (str) – url for a request to be sent to

  • kwargs – additional args

Returns

request res

Return type

requests.models.Response