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
| Parameter | Type | Description |
|---|---|---|
| host | str | The host name or IP address of the Deephaven server. |
| port optional | int | The port number that the remote Deephaven server is listening on. The default value is |
| auth_type optional | str | 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 optional | str | The authentication token string. When auth_type is Basic, it must be "user:password". When |
| use_tls optional | bool | If |
| tls_root_certs optional | bytes | The PEM-encoded root certificates to use for TLS connection, or |
Returns
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",
)