deephaven.barrage

This module defines the BarrageSession wrapper class and provides a factory function to create an instance of it for accessing resources on remote Deephaven servers.

class BarrageSession(j_barrage_session, j_managed_channel=None)[source]

Bases: object

A Deephaven Barrage session to a remote server.

Initializes a Barrage session.

When BarrageSession is created via the barrage_session() factory function, j_managed_channel is always provided, and when BarrageSession.close() is called, it will shut down the channel as well as close the j_barrage_session.

When BarrageSession is initialized directly and j_managed_channel is None, when BarrageSession.close() is called, it will only close the j_barrage_session, it is the responsibility of the user to shut down the associated channel if needed.

close()[source]

Closes the barrage session.

If the BarrageSession is initialized with a managed channel, the channel will be shut down as well.

Return type:

None

snapshot(ticket)[source]

Returns a snapshot of a published remote table with the given ticket.

Note, if the remote table is closed or its owner session is closed, the ticket becomes invalid. If the same ticket is snapshot multiple times, multiple snapshots will be created.

Parameters:

ticket (bytes) – the bytes of the ticket

Return type:

Table

Returns:

a Table

Raises:

DHError

subscribe(ticket)[source]

Subscribes to a published remote table with the given ticket.

Note, if the remote table is closed or its owner session is closed, the ticket becomes invalid. If the same ticket is subscribed to multiple times, multiple subscriptions will be created.

Parameters:

ticket (bytes) – the bytes of the ticket

Return type:

Table

Returns:

a Table

Raises:

DHError

barrage_session(host, port=10000, auth_type='Anonymous', auth_token='', use_tls=False, tls_root_certs=None)[source]

Returns a Deephaven gRPC session to a remote server if a cached session is available; otherwise, creates a new session.

Note: client authentication is not supported yet.

Parameters:
  • host (str) – the host name or IP address of the Deephaven server.

  • port (int) – the port number that the remote Deephaven server is listening on, default is 10000.

  • auth_type (str) – the authentication type string, can be “Anonymous’, ‘Basic”, or any custom-built authenticator in the server, such as “io.deephaven.authentication.psk.PskAuthenticationHandler”, default is ‘Anonymous’.

  • auth_token (str) – the authentication token string. When auth_type is ‘Basic’, it must be “user:password”; when auth_type is “Anonymous’, it will be ignored; when auth_type is a custom-built authenticator, it must conform to the specific requirement of the authenticator

  • use_tls (bool) – if True, use a TLS connection. Defaults to False

  • tls_root_certs (bytes) – PEM encoded root certificates to use for TLS connection, or None to use system defaults. If not None implies use a TLS connection and the use_tls argument should have been passed as True. Defaults to None

Return type:

BarrageSession

Returns:

a Deephaven Barrage session

Raises:

DHError