Skip to main content
Version: Python

barrage_session

The barrage_session method returns a cached Deephaven gRPC session (BarrageSession) to a remote server if one is available; otherwise, it creates a new BarrageSession.

Syntax

barrage_session(
host: str,
port: int = 10000,
auth_type: str = 'Anonymous',
auth_token: str = '',
use_tls: bool = False,
tls_root_certs: bytes = None
) -> BarrageSession

Parameters

ParameterTypeDescription
hoststr

The host name or IP address of the Deephaven server.

port optionalint

The port number that the remote Deephaven server is listening on. The default value is 10000.

auth_type optionalstr

The authentication type string. Can be "Anonymous", "Basic", or any custom-built authenticator in the server, such as "io.deephaven.authentication.psk.PskAuthenticationHandler". The default is "Anonymous"

auth_token optionalstr

The authentication token string. When auth_type is Basic, it must be "user:password". When auth_type is Anonymous, auth_token will be ignored. When auth_type is a custom-built authenticator, auth_token must conform to the specific requirements of the authenticator.

use_tls optionalbool

If True, the connection will be encrypted using TLS. The default is False.

tls_root_certs optionalbytes

The PEM-encoded root certificates to use for TLS connection, or None to use system defaults. True implies the use of a TLS connection and the use_tls argument should be passed as True. Defaults to None.

Returns

A BarrageSession.

Examples

The following example creates a BarrageSession on a Deephaven server running on localhost at port 10000.

from deephaven.barrage import barrage_session

barrage_sesh = barrage_session("localhost", 10000)

The following example connects to a BarrageSession on a Deephaven server running on localhost at port 9999. This example will fail unless there is already a Deephaven server running on localhost at port 9999.

from deephaven.barrage import barrage_session

barrage_sesh = barrage_session("localhost", 9999)

The following example connects to a Deephaven server running on a remote host at IP address 192.0.2.1 and port 10000. This example will fail unless there is already a Deephaven server running at the specified IP address and port.

from deephaven.barrage import barrage_session

barrage_sesh = barrage_session("192.0.2.1", 10000)

The following example connects to a Deephaven server running on localhost at port 9999, with pre-shared-key (PSK) authentication. This example will fail unless there is already a Deephaven server running on localhost at port 9999, with matching PSK authentication.

from deephaven.barrage import barrage_session

barrage_sesh = barrage_session(
host="localhost",
port=9999,
auth_type="io.deephaven.authentication.psk.PskAuthenticationHandler",
auth_token="PASSWORD",
)