Skip to content

Commit 596d762

Browse files
committed
feat: updated R session interface
1 parent 800b984 commit 596d762

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

datashield/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def profiles(self) -> dict:
199199
def packages(self) -> dict:
200200
"""
201201
Get the list of DataSHIELD packages with their version, that have been configured on the remote data repository.
202-
202+
203203
:return: The list of DataSHIELD packages with their version, that have been configured on the remote data repository, per remote server name
204204
"""
205205
rval = {}
@@ -227,7 +227,7 @@ def workspaces(self) -> dict:
227227
"""
228228
Get the list of DataSHIELD workspaces, that have been saved on the remote data repository.
229229
230-
:return: The list of DataSHIELD workspaces, that have been saved on the remote data repository, per remote server name
230+
:return: The list of DataSHIELD workspaces, that have been saved on the remote data repository, per remote server name
231231
"""
232232
rval = {}
233233
for conn in self.conns:
@@ -294,7 +294,7 @@ def sessions(self) -> dict:
294294
def ls(self) -> dict:
295295
"""
296296
After assignments have been performed, list the symbols that live in the DataSHIELD R session on the server side.
297-
297+
298298
:return: The symbols that live in the DataSHIELD R session on the server side, per remote server name
299299
"""
300300
self._init_errors()

datashield/interface.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,33 @@ class RSession:
6363
R Session (server side) class to a DataSHIELD server.
6464
"""
6565

66+
def is_started(self) -> bool:
67+
"""
68+
Get whether the session has been started. This call must not wait for the session to
69+
be started, immediate response is expected.
70+
71+
:return: Whether the session has been started
72+
"""
73+
raise NotImplementedError("RSession function not available")
74+
6675
def is_ready(self) -> bool:
6776
"""
6877
Get whether the session is ready for receiving requests. This call must not
6978
wait for the session to be ready, immediate response is expected.
7079
7180
:return: Whether the session is ready
81+
:throws: DSError if the session was not started or session information is not available
7282
"""
7383
raise NotImplementedError("RSession function not available")
7484

7585
def is_pending(self) -> bool:
7686
"""
77-
Get whether the session is pending, i.e., it is in the process of being started but is not ready yet. This call must not
78-
wait for the session to be pending, immediate response is expected.
87+
Get whether the session is pending, i.e., it is in the process of being started but is
88+
not ready yet. This call must not wait for the session to be pending, immediate response
89+
is expected.
7990
8091
:return: Whether the session is pending
92+
:throws: DSError if the session was not started or session information is not available
8193
"""
8294
raise NotImplementedError("RSession function not available")
8395

@@ -87,14 +99,26 @@ def is_failed(self) -> bool:
8799
wait for the session to have failed, immediate response is expected.
88100
89101
:return: Whether the session has failed
102+
:throws: DSError if the session was not started or session information is not available
103+
"""
104+
raise NotImplementedError("RSession function not available")
105+
106+
def is_terminated(self) -> bool:
107+
"""
108+
Get whether the session is terminated. This call must not wait for the session to be
109+
terminated, immediate response is expected.
110+
111+
:return: Whether the session is terminated
112+
:throws: DSError if the session was not started or session information is not available
90113
"""
91114
raise NotImplementedError("RSession function not available")
92115

93-
def get_state_message(self) -> str:
116+
def get_last_message(self) -> str:
94117
"""
95118
Get a message describing the current state of the session, which can be used for debugging or logging purposes.
96119
97120
:return: The session state message
121+
:throws: DSError if the session was not started or session information is not available
98122
"""
99123
raise NotImplementedError("RSession function not available")
100124

0 commit comments

Comments
 (0)