Skip to content

Commit

Permalink
Pyclient groovy support (#2107)
Browse files Browse the repository at this point in the history
* added configurable session type to pyclient

* self.session_type assignment if None

* default string in constructor

* appended underscore to class variable
  • Loading branch information
jakemulf authored Mar 29, 2022
1 parent 2c081f8 commit 533e82a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyclient/pydeephaven/_console_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def start_console(self):
try:
result_id = self.session.make_ticket()
response = self._grpc_console_stub.StartConsole(
console_pb2.StartConsoleRequest(result_id=result_id, session_type='python'),
console_pb2.StartConsoleRequest(result_id=result_id, session_type=self.session._session_type),
metadata=self.session.grpc_metadata)
self.console_id = response.result_id
except Exception as e:
Expand Down
4 changes: 3 additions & 1 deletion pyclient/pydeephaven/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ class Session:
is_alive (bool): check if the session is still alive (may refresh the session)
"""

def __init__(self, host: str = None, port: int = None, never_timeout: bool = True):
def __init__(self, host: str = None, port: int = None, never_timeout: bool = True, session_type: str = 'python'):
""" Initialize a Session object that connects to the Deephaven server
Args:
host (str): the host name or IP address of the remote machine, default is 'localhost'
port (int): the port number that Deephaven server is listening on, default is 10000
never_timeout (bool, optional): never allow the session to timeout, default is True
session_type (str, optional): the Deephaven session type. Defaults to 'python'
Raises:
DHError
Expand Down Expand Up @@ -67,6 +68,7 @@ def __init__(self, host: str = None, port: int = None, never_timeout: bool = Tru
self._tables = {}
self._never_timeout = never_timeout
self._keep_alive_timer = None
self._session_type = session_type

self._connect()

Expand Down

0 comments on commit 533e82a

Please sign in to comment.