File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
gooddata-sdk/gooddata_sdk/compute Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 33
44import logging
55
6+ from gooddata_api_client .model .afm_cancel_tokens import AfmCancelTokens
67from gooddata_api_client .model .chat_history_request import ChatHistoryRequest
78from gooddata_api_client .model .chat_history_result import ChatHistoryResult
89from gooddata_api_client .model .chat_request import ChatRequest
@@ -108,3 +109,24 @@ def ai_chat_history_reset(self, workspace_id: str) -> None:
108109 """
109110 chat_history_request = ChatHistoryRequest (reset = True )
110111 self ._actions_api .ai_chat_history (workspace_id , chat_history_request , _check_return_type = False )
112+
113+ def cancel_executions (self , executions : list [Execution ]) -> None :
114+ """
115+ Try to cancel given executions using the cancel api endpoint.
116+
117+ *Note that this is currently a noop, we will be enabling this functionality soon.*
118+
119+ Args:
120+ executions: list of executions to send for cancellation
121+ """
122+ workspace_to_tokens : dict [str , set [str ]] = {}
123+
124+ for execution in executions :
125+ if not workspace_to_tokens [execution .workspace_id ]:
126+ workspace_to_tokens [execution .workspace_id ] = set ()
127+
128+ if execution .cancel_token :
129+ workspace_to_tokens [execution .workspace_id ].add (execution .cancel_token )
130+
131+ for workspace_id , token_ids in workspace_to_tokens .items ():
132+ self ._actions_api .cancel_executions (workspace_id , AfmCancelTokens (list (token_ids )))
You can’t perform that action at this time.
0 commit comments