@@ -43,7 +43,7 @@ def run_worksheet(self, wait=True):
4343 """
4444 Computes the results of the whole worksheet.
4545
46- :returns: a :class:`~dataikuapi.dss.future.DSSFuture` handle
46+ :returns: a :class:`DSSStatisticsCardResult` if `wait` is `True`, or a :class:` ~dataikuapi.dss.future.DSSFuture` handle otherwise
4747 """
4848
4949 root_card = self .get_settings ().get_raw ()['rootCard' ]
@@ -57,7 +57,7 @@ def run_card(self, card, wait=True):
5757
5858 :param card: a card to compute
5959 :type card: :class:`DSSStatisticsCardSettings` or dict (obtained from ``DSSStatisticsCardSettings.get_raw()``)
60- :returns: a :class:`~dataikuapi.dss.future.DSSFuture` handle to the task of computing card's results
60+ :returns: a :class:`DSSStatisticsCardResult` if `wait` is `True`, or a :class:` ~dataikuapi.dss.future.DSSFuture` handle otherwise
6161 """
6262
6363 card = DSSStatisticsCardSettings ._from_card_or_dict (self .client , card )
@@ -67,8 +67,13 @@ def run_card(self, card, wait=True):
6767 self .project_key , self .dataset_name , self .worksheet_id ),
6868 body = card .get_raw ()
6969 )
70- future = DSSFuture (self .client , future_response .get (
71- "jobId" , None ), future_response )
70+
71+ def wrap_card_result (result ):
72+ return DSSStatisticsCardResult (result )
73+
74+ future = DSSFuture (self .client , future_response .get ("jobId" , None ),
75+ future_response , result_wrapper = wrap_card_result )
76+
7277 return future .wait_for_result () if wait else future
7378
7479 def run_computation (self , computation , wait = True ):
@@ -77,7 +82,7 @@ def run_computation(self, computation, wait=True):
7782
7883 :param computation: a card to compute
7984 :type computation: :class:`DSSStatisticsComputationSettings` or dict (obtained from ``DSSStatisticsComputationSettings.get_raw()``)
80- :returns: a :class:`~dataikuapi.dss.future.DSSFuture` handle to the task of computing computation's results
85+ :returns: a :class:`DSSStatisticsComputationResult`, or a :class:` ~dataikuapi.dss.future.DSSFuture` handle otherwise
8186 """
8287
8388 computation = DSSStatisticsComputationSettings ._from_computation_or_dict (
@@ -88,8 +93,13 @@ def run_computation(self, computation, wait=True):
8893 self .project_key , self .dataset_name , self .worksheet_id ),
8994 body = computation .get_raw ()
9095 )
91- future = DSSFuture (self .client , future_response .get (
92- "jobId" , None ), future_response )
96+
97+ def wrap_computation_result (result ):
98+ return DSSStatisticsComputationResult (result )
99+
100+ future = DSSFuture (self .client , future_response .get ("jobId" , None ),
101+ future_response , result_wrapper = wrap_computation_result )
102+
93103 return future .wait_for_result () if wait else future
94104
95105
@@ -152,6 +162,10 @@ def save(self):
152162
153163
154164class DSSStatisticsCardSettings (DSSInternalDict ):
165+ """
166+ Object to manipulate the settings of a card
167+ """
168+
155169 def __init__ (self , client , card_definition ):
156170 super (DSSStatisticsCardSettings , self ).__init__ (card_definition )
157171 self .client = client
@@ -175,7 +189,18 @@ def _from_card_or_dict(client, card_or_dict):
175189 return DSSStatisticsCardSettings (client , card_or_dict )
176190
177191
192+ class DSSStatisticsCardResult (DSSInternalDict ):
193+ """
194+ Object storing the results of a :class:`DSSStatisticsCardSettings`
195+ """
196+ pass
197+
198+
178199class DSSStatisticsComputationSettings (DSSInternalDict ):
200+ """
201+ Object to manipulate the settings of a computation
202+ """
203+
179204 def __init__ (self , computation_definition ):
180205 super (DSSStatisticsComputationSettings ,
181206 self ).__init__ (computation_definition )
@@ -186,3 +211,10 @@ def _from_computation_or_dict(computation_or_dict):
186211 if isinstance (computation_or_dict , DSSStatisticsComputationSettings ):
187212 computation_or_dict = computation_or_dict .get_raw ()
188213 return DSSStatisticsComputationSettings (computation_or_dict )
214+
215+
216+ class DSSStatisticsComputationResult (DSSInternalDict ):
217+ """
218+ Object storing the results of a :class:`DSSStatisticsComputationSettings`
219+ """
220+ pass
0 commit comments