File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
gooddata-sdk/gooddata_sdk/compute Expand file tree Collapse file tree 1 file changed +20
-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,22 @@ 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+ Args:
118+ executions: list of executions to cancel
119+ """
120+ workspace_to_tokens : dict [str , AfmCancelTokens ] = {}
121+
122+ for execution in executions :
123+ if not workspace_to_tokens [execution .workspace_id ]:
124+ workspace_to_tokens [execution .workspace_id ] = set ()
125+
126+ if execution .cancel_token :
127+ workspace_to_tokens [execution .workspace_id ].token_ids .add (execution .cancel_token )
128+
129+ for workspace_id , token_ids in workspace_to_tokens .items ():
130+ self ._actions_api .cancel_executions (workspace_id , AfmCancelTokens (list (token_ids )))
You can’t perform that action at this time.
0 commit comments