qctrl-workflow-client 4.0.0__tar.gz → 5.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/PKG-INFO +2 -2
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/pyproject.toml +2 -2
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/__init__.py +2 -7
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/defaults.py +7 -35
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/api.py +11 -6
- qctrl_workflow_client-4.0.0/qctrlworkflowclient/globals.py +0 -60
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/LICENSE +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/README.md +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/functions.py +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/products.py +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/__init__.py +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/base.py +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/local.py +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/settings.py +0 -0
- {qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qctrl-workflow-client
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.1
|
|
4
4
|
Summary: Q-CTRL Client
|
|
5
5
|
Home-page: https://q-ctrl.com
|
|
6
6
|
License: https://q-ctrl.com/terms
|
|
@@ -31,7 +31,7 @@ Classifier: Topic :: System :: Distributed Computing
|
|
|
31
31
|
Requires-Dist: gql (>=3.4.0,<4.0.0)
|
|
32
32
|
Requires-Dist: importlib-metadata (>=6.8.0,<7.0.0)
|
|
33
33
|
Requires-Dist: packaging (>=23.1.0,<24.0.0)
|
|
34
|
-
Requires-Dist: qctrl-client (>=10.
|
|
34
|
+
Requires-Dist: qctrl-client (>=10.1.0,<11.0.0)
|
|
35
35
|
Requires-Dist: qctrl-commons (>=23.0.0,<24.0.0)
|
|
36
36
|
Requires-Dist: requests (>=2.32.0,<3.0.0)
|
|
37
37
|
Requires-Dist: tenacity (>=8.1.0,<9.0.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "qctrl-workflow-client"
|
|
3
|
-
version = "
|
|
3
|
+
version = "5.0.1"
|
|
4
4
|
description = "Q-CTRL Client"
|
|
5
5
|
license = "https://q-ctrl.com/terms"
|
|
6
6
|
authors = ["Q-CTRL <support@q-ctrl.com>"]
|
|
@@ -82,7 +82,7 @@ tenacity = "^8.1.0"
|
|
|
82
82
|
requests = "^2.32.0"
|
|
83
83
|
packaging = "^23.1.0"
|
|
84
84
|
qctrl-commons = { version = "^23.0.0", source = "PyPI" }
|
|
85
|
-
qctrl-client = { version = "^10.
|
|
85
|
+
qctrl-client = { version = "^10.1.0", source = "PyPI" }
|
|
86
86
|
|
|
87
87
|
[tool.poetry.group.dev.dependencies]
|
|
88
88
|
black = "^24.3.0"
|
|
@@ -11,14 +11,9 @@
|
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS. See the
|
|
12
12
|
# License for the specific language.
|
|
13
13
|
|
|
14
|
-
__version__ = "
|
|
14
|
+
__version__ = "5.0.1"
|
|
15
15
|
|
|
16
|
-
from .defaults import
|
|
17
|
-
get_authenticated_client_for_product,
|
|
18
|
-
get_default_api_url,
|
|
19
|
-
get_default_cli_auth,
|
|
20
|
-
get_default_oidc_url,
|
|
21
|
-
)
|
|
16
|
+
from .defaults import get_authenticated_client_for_product
|
|
22
17
|
from .functions import (
|
|
23
18
|
core_workflow,
|
|
24
19
|
print_warnings,
|
|
@@ -13,50 +13,22 @@
|
|
|
13
13
|
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
|
-
import os
|
|
17
16
|
from typing import Optional
|
|
18
17
|
|
|
19
|
-
from qctrlclient
|
|
20
|
-
BaseAuth,
|
|
18
|
+
from qctrlclient import (
|
|
21
19
|
CliAuth,
|
|
22
|
-
)
|
|
23
|
-
from qctrlclient.client import (
|
|
24
20
|
GraphQLClient,
|
|
25
|
-
GraphQLClientError,
|
|
26
21
|
)
|
|
22
|
+
from qctrlclient.auth import BaseAuth
|
|
23
|
+
from qctrlclient.defaults import (
|
|
24
|
+
get_default_cli_auth,
|
|
25
|
+
get_default_oidc_url,
|
|
26
|
+
)
|
|
27
|
+
from qctrlclient.exceptions import GraphQLClientError
|
|
27
28
|
from qctrlcommons.utils import generate_user_agent
|
|
28
29
|
|
|
29
|
-
from .globals import global_value
|
|
30
30
|
from .utils import get_installed_version
|
|
31
31
|
|
|
32
|
-
_DEFAULT_API_URL = "https://federation-service.q-ctrl.com"
|
|
33
|
-
_DEFAULT_OIDC_URL = "https://id.q-ctrl.com"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def get_default_api_url() -> str:
|
|
37
|
-
"""
|
|
38
|
-
Return the default API URL. Can be overridden by
|
|
39
|
-
setting the `QCTRL_API_URL` environment variable.
|
|
40
|
-
"""
|
|
41
|
-
return os.getenv("QCTRL_API_URL", _DEFAULT_API_URL)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def get_default_oidc_url() -> str:
|
|
45
|
-
"""
|
|
46
|
-
Return the default OIDC URL. Can be overridden by
|
|
47
|
-
setting the `QCTRL_OIDC_URL` environment variable.
|
|
48
|
-
"""
|
|
49
|
-
return os.getenv("QCTRL_OIDC_URL", _DEFAULT_OIDC_URL)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
@global_value("DEFAULT_CLI_AUTH")
|
|
53
|
-
def get_default_cli_auth() -> CliAuth:
|
|
54
|
-
"""
|
|
55
|
-
Return default `CliAuth` object.
|
|
56
|
-
"""
|
|
57
|
-
url = get_default_oidc_url()
|
|
58
|
-
return CliAuth(url)
|
|
59
|
-
|
|
60
32
|
|
|
61
33
|
def get_authenticated_client_for_product(
|
|
62
34
|
product_access_required: str,
|
{qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/api.py
RENAMED
|
@@ -480,13 +480,15 @@ class ApiRouter(BaseRouter):
|
|
|
480
480
|
"""
|
|
481
481
|
return self.update_action_status(action)
|
|
482
482
|
|
|
483
|
-
def get_result(
|
|
483
|
+
def get_result(
|
|
484
|
+
self, action: Action, revoke_on_interrupt: bool = True
|
|
485
|
+
) -> DecodedResult:
|
|
484
486
|
"""
|
|
485
487
|
Return the result of the action.
|
|
486
488
|
"""
|
|
487
|
-
return self._fetch_action(action).result
|
|
489
|
+
return self._fetch_action(action, revoke_on_interrupt).result
|
|
488
490
|
|
|
489
|
-
def _fetch_action(self, action: Action) -> Any:
|
|
491
|
+
def _fetch_action(self, action: Action, revoke_on_interrupt: bool = True) -> Any:
|
|
490
492
|
"""
|
|
491
493
|
Fetch the action from the server. If the action
|
|
492
494
|
has not finished, the API will be polled until it has.
|
|
@@ -497,9 +499,12 @@ class ApiRouter(BaseRouter):
|
|
|
497
499
|
if not action.is_finished():
|
|
498
500
|
try:
|
|
499
501
|
action = self._poll_for_completion(action)
|
|
500
|
-
except KeyboardInterrupt:
|
|
501
|
-
|
|
502
|
-
|
|
502
|
+
except KeyboardInterrupt as exc:
|
|
503
|
+
if revoke_on_interrupt:
|
|
504
|
+
self._revoke_action(action)
|
|
505
|
+
action = self._poll_for_completion(action)
|
|
506
|
+
else:
|
|
507
|
+
raise KeyboardInterrupt from exc
|
|
503
508
|
|
|
504
509
|
if action.is_failed():
|
|
505
510
|
self._settings.event_dispatch("action.failure", action=action)
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Copyright 2024 Q-CTRL. All rights reserved.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Q-CTRL Terms of service (the "License"). Unauthorized
|
|
4
|
-
# copying or use of this file, via any medium, is strictly prohibited.
|
|
5
|
-
# Proprietary and confidential. You may not use this file except in compliance
|
|
6
|
-
# with the License. You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# https://q-ctrl.com/terms
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS. See the
|
|
12
|
-
# License for the specific language.
|
|
13
|
-
|
|
14
|
-
from functools import wraps
|
|
15
|
-
from typing import (
|
|
16
|
-
Any,
|
|
17
|
-
Callable,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
_REGISTRY = {}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def global_value(key: str) -> Callable:
|
|
24
|
-
"""
|
|
25
|
-
Add values to a global registry. If the
|
|
26
|
-
`key` already exists in the registry, the
|
|
27
|
-
stored value is returned.
|
|
28
|
-
"""
|
|
29
|
-
|
|
30
|
-
def decorator(func: Callable) -> Callable:
|
|
31
|
-
@wraps(func)
|
|
32
|
-
def customized_decorator() -> Any:
|
|
33
|
-
try:
|
|
34
|
-
value = _REGISTRY[key]
|
|
35
|
-
except KeyError:
|
|
36
|
-
value = func()
|
|
37
|
-
_REGISTRY[key] = value
|
|
38
|
-
|
|
39
|
-
return value
|
|
40
|
-
|
|
41
|
-
return customized_decorator
|
|
42
|
-
|
|
43
|
-
return decorator
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def update_global_value(key, value: Any):
|
|
47
|
-
"""Update global registry value."""
|
|
48
|
-
if key in _REGISTRY:
|
|
49
|
-
_REGISTRY[key] = value
|
|
50
|
-
else:
|
|
51
|
-
raise KeyError(f"Key not found in the registry: {key}")
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def invalidate_global_value(*keys: str):
|
|
55
|
-
"""
|
|
56
|
-
Remove the globally registered values, if they exist.
|
|
57
|
-
"""
|
|
58
|
-
for key in keys:
|
|
59
|
-
if key in _REGISTRY:
|
|
60
|
-
del _REGISTRY[key]
|
|
File without changes
|
|
File without changes
|
{qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/functions.py
RENAMED
|
File without changes
|
|
File without changes
|
{qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/__init__.py
RENAMED
|
File without changes
|
{qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/base.py
RENAMED
|
File without changes
|
{qctrl_workflow_client-4.0.0 → qctrl_workflow_client-5.0.1}/qctrlworkflowclient/router/local.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|