Skip to content

[bot] Merge master/d08da677 into rel/dev #1023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions gooddata-sdk/gooddata_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(
token: str,
custom_headers: Optional[dict[str, str]] = None,
extra_user_agent: Optional[str] = None,
executions_cancellable: bool = False,
) -> None:
"""Take url, token for connecting to GoodData.CN.

Expand All @@ -32,6 +33,11 @@ def __init__(

`extra_user_agent` is optional string to be added to default http User-Agent
header. This takes precedence over custom_headers setting.

`executions_cancellable` is a flag that sets all executions computed through this client as cancellable.
In case a request for a result is interrupted, the GD server will try to free resources like killing sql queries
related to the given execution.
*This feature does not work yet, it will be rolled out soon.*
"""
self._hostname = host
self._token = token
Expand All @@ -57,6 +63,7 @@ def __init__(
self._layout_api = apis.LayoutApi(self._api_client)
self._actions_api = apis.ActionsApi(self._api_client)
self._user_management_api = apis.UserManagementApi(self._api_client)
self._executions_cancellable = executions_cancellable

def _do_post_request(
self,
Expand Down Expand Up @@ -138,3 +145,7 @@ def actions_api(self) -> apis.ActionsApi:
@property
def user_management_api(self) -> apis.UserManagementApi:
return self._user_management_api

@property
def executions_cancellable(self) -> bool:
return self._executions_cancellable
4 changes: 3 additions & 1 deletion gooddata-sdk/gooddata_sdk/compute/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def for_exec_def(self, workspace_id: str, exec_def: ExecutionDefinition) -> Exec
workspace_id=workspace_id,
exec_def=exec_def,
response=response,
cancel_token=response.headers.get("X-GDC-CANCEL-TOKEN") if exec_def.is_cancellable else None,
cancel_token=response.headers.get("X-GDC-CANCEL-TOKEN")
if exec_def.is_cancellable or self._api_client.executions_cancellable
else None,
)

def retrieve_result_cache_metadata(self, workspace_id: str, result_id: str) -> ResultCacheMetadata:
Expand Down
Loading