Skip to content

Commit 158aea8

Browse files
committed
fix: compute.cancel_executions
- fixed one bug in compute.cancel_executions - Execution is unusable outside of our codebase, removed from export and refactored arguments in cancel_executions risk: low
1 parent 72fc12c commit 158aea8

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

gooddata-sdk/gooddata_sdk/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@
231231
from gooddata_sdk.compute.model.base import ExecModelEntity, ObjId
232232
from gooddata_sdk.compute.model.execution import (
233233
BareExecutionResponse,
234-
Execution,
235234
ExecutionDefinition,
236235
ExecutionResponse,
237236
ExecutionResult,

gooddata-sdk/gooddata_sdk/compute/service.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,25 @@ def ai_chat_history_reset(self, workspace_id: str) -> None:
112112
chat_history_request = ChatHistoryRequest(reset=True)
113113
self._actions_api.ai_chat_history(workspace_id, chat_history_request, _check_return_type=False)
114114

115-
def cancel_executions(self, executions: list[Execution]) -> None:
115+
def cancel_executions(self, executions: list[tuple[str, str]]) -> None:
116116
"""
117117
Try to cancel given executions using the cancel api endpoint.
118+
Order of token applications is not guaranteed.
118119
119120
*Note that this is currently a noop, we will be enabling this functionality soon.*
120121
121122
Args:
122-
executions: list of executions to send for cancellation
123+
executions: list of tuples [workspace_id, cancel_token] to send for cancellation
123124
"""
124125
workspace_to_tokens: dict[str, set[str]] = {}
125126

126127
for execution in executions:
127-
if not workspace_to_tokens[execution.workspace_id]:
128-
workspace_to_tokens[execution.workspace_id] = set()
128+
workspace_id, cancel_token = execution
129129

130-
if execution.cancel_token:
131-
workspace_to_tokens[execution.workspace_id].add(execution.cancel_token)
130+
if workspace_id not in workspace_to_tokens:
131+
workspace_to_tokens[workspace_id] = set()
132+
133+
workspace_to_tokens[workspace_id].add(cancel_token)
132134

133135
for workspace_id, token_ids in workspace_to_tokens.items():
134136
self._actions_api.cancel_executions(workspace_id, AfmCancelTokens(list(token_ids)))

0 commit comments

Comments
 (0)