gRPC Client

class Client(host=None, auth=None, certificate=None, port=None, channel=None)[source]

Low-level gRPC client for interacting with the Workflows backend. Not intended for users to use directly.

Examples

>>> from descarteslabs.workflows import Client, Int
>>> my_client = Client(auth=non_default_auth) 
>>> Int(1).compute(client=my_client) 
1
>>> Int(1).publish("One", client=my_client) 
<descarteslabs.workflows.models.workflow.Workflow object at 0x...>

Attributes:

DEFAULT_TIMEOUT

STREAM_TIMEOUT

api

The available Client operations, as a dict.

certificate

The Client SSL certificate.

channel

The GRPC channel of the Client.

token

The Client token.

Methods:

INSECURE_CHANNEL_FACTORY(target[, options, …])

Creates an insecure Channel to a server.

SECURE_CHANNEL_FACTORY(target, credentials)

Creates a secure Channel to a server.

close()

Close the GRPC channel associated with the Client.

health([timeout])

Check the health of the GRPC server (SERVING, NOT_SERVING, UNKNOWN).

static INSECURE_CHANNEL_FACTORY(target, options=None, compression=None)

Creates an insecure Channel to a server.

The returned Channel is thread-safe.

Parameters
  • target – The server address

  • options – An optional list of key-value pairs (channel_arguments in gRPC Core runtime) to configure the channel.

  • compression – An optional value indicating the compression method to be used over the lifetime of the channel. This is an EXPERIMENTAL option.

Returns

A Channel.

static SECURE_CHANNEL_FACTORY(target, credentials, options=None, compression=None)

Creates a secure Channel to a server.

The returned Channel is thread-safe.

Parameters
  • target – The server address.

  • credentials – A ChannelCredentials instance.

  • options – An optional list of key-value pairs (channel_arguments in gRPC Core runtime) to configure the channel.

  • compression – An optional value indicating the compression method to be used over the lifetime of the channel. This is an EXPERIMENTAL option.

Returns

A Channel.

close()

Close the GRPC channel associated with the Client.

health(timeout=None)

Check the health of the GRPC server (SERVING, NOT_SERVING, UNKNOWN).

Example

>>> from descarteslabs.client.grpc import GrpcClient
>>> GrpcClient().health() 
SERVING
DEFAULT_TIMEOUT = 5
STREAM_TIMEOUT = 86400
property api

The available Client operations, as a dict.

property certificate

The Client SSL certificate.

property channel

The GRPC channel of the Client.

property token

The Client token.