atlan-application-sdk-api 3.55.3__tar.gz → 3.56.0__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.
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/PKG-INFO +2 -2
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_build_info.py +1 -1
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_runtime/__init__.py +1 -1
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_runtime/cgroup.py +4 -3
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_runtime/offload.py +24 -4
- atlan_application_sdk_api-3.56.0/application_sdk/common/utils.py +147 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/constants.py +77 -14
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/ref.py +36 -27
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/server/fastapi/models.py +95 -3
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/version.py +1 -1
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/pyproject.toml +2 -2
- atlan_application_sdk_api-3.55.3/application_sdk/common/utils.py +0 -87
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/.gitignore +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/README.md +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/api-files.txt +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_context_errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_install.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_logging.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_runtime/progress.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/_interface.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/_sql_failure_classifier.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/base.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/http_errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/models.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/sql.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/sql_errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/sql_typecasters.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/ssl_utils.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/_generated_tree.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/_listing.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/aws_utils.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/aws_utils_errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/backoff.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/build_identity.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/concurrency.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/filter_matching.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/logger.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/models.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/sql_filters.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/sql_filters_errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/task_queue.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/common/types.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/contracts/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/contracts/base.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/contracts/events.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/contracts/types.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/contracts/types_errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/extra.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/ingress.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/requirements.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/spec.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/types.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/credentials/utils.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/base.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/categories.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/http.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/leaves.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/wire.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/_dispatch.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/_warmup.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/asgi.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/base.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/context.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/contracts.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/manifest.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/metadata_routes.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/object_routes.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/request_contract.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/routes.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/handler/service_errors.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/server/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/templates/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/templates/contracts/__init__.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/templates/contracts/base_metadata_extraction.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/templates/contracts/incremental_sql.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/templates/contracts/sql_metadata.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/templates/contracts/sql_query.py +0 -0
- {atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/hatch_build.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: atlan-application-sdk-api
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.56.0
|
|
4
4
|
Summary: Experimental: the handler surface of the Atlan Application SDK, for the consolidated API host
|
|
5
5
|
Project-URL: Homepage, https://github.com/atlanhq/application-sdk
|
|
6
6
|
Project-URL: Source, https://github.com/atlanhq/application-sdk/tree/main/packages/api
|
|
@@ -32,7 +32,7 @@ Requires-Dist: python-dotenv<2.0.0,>=1.2.2; extra == 'aws'
|
|
|
32
32
|
Provides-Extra: pandas
|
|
33
33
|
Requires-Dist: pandas<4.0.0,>=2.2.3; extra == 'pandas'
|
|
34
34
|
Provides-Extra: pyatlan
|
|
35
|
-
Requires-Dist: authlib<2,>=1.9.
|
|
35
|
+
Requires-Dist: authlib<2,>=1.9.5; extra == 'pyatlan'
|
|
36
36
|
Requires-Dist: pyatlan<12,>=11.7.0; extra == 'pyatlan'
|
|
37
37
|
Provides-Extra: sql
|
|
38
38
|
Requires-Dist: httpx<0.29.0,>=0.27.0; extra == 'sql'
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_build_info.py
RENAMED
|
@@ -27,7 +27,7 @@ def load_build_info(path: str | None = None) -> dict[str, str]:
|
|
|
27
27
|
Missing or malformed file → ``{}``; callers fall back to the env vars.
|
|
28
28
|
``ATLAN_BUILD_INFO_PATH`` overrides the lookup for non-template layouts.
|
|
29
29
|
|
|
30
|
-
Public because :mod:`application_sdk.
|
|
30
|
+
Public because :mod:`application_sdk.common.build_identity` reads the same file
|
|
31
31
|
through it. A second parser there would be a second place for the key names
|
|
32
32
|
to drift from what CI writes.
|
|
33
33
|
"""
|
|
@@ -14,7 +14,7 @@ auto-holds work). Nothing else in ``application_sdk``: never
|
|
|
14
14
|
``application_sdk.storage``, ``application_sdk.execution`` or
|
|
15
15
|
``application_sdk.app`` — each of those pulls in ``storage.ops`` transitively,
|
|
16
16
|
which is exactly the cycle this package exists to remove.
|
|
17
|
-
``tests/unit/
|
|
17
|
+
``tests/unit/_runtime/test_layering.py`` enforces this in a subprocess, so
|
|
18
18
|
breaking the rule fails CI rather than surfacing as an ``ImportError`` at some
|
|
19
19
|
unrelated call site months later.
|
|
20
20
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"""The container's CPU limit, readable from the bottom layer (ADR-0019).
|
|
2
2
|
|
|
3
3
|
``os.cpu_count()`` reports the node's cores, not the pod's: a worker limited to
|
|
4
|
-
one CPU on a 16-core node sees 16. Anything
|
|
5
|
-
fault-isolation process pool in
|
|
6
|
-
|
|
4
|
+
one CPU on a 16-core node sees 16. Anything sized by CPU — the ``sdk-blocking-``
|
|
5
|
+
thread pool and the fault-isolation process pool in
|
|
6
|
+
:mod:`application_sdk._runtime.offload`, and the worker's default activity slots
|
|
7
|
+
— reads the limit here instead. :mod:`application_sdk.observability.cgroup` reports the
|
|
7
8
|
same number for sizing telemetry and delegates to this module, so the two can
|
|
8
9
|
never disagree about what the limit is.
|
|
9
10
|
|
|
@@ -63,8 +63,28 @@ P = ParamSpec("P")
|
|
|
63
63
|
# This single instance is created once at module import and intentionally
|
|
64
64
|
# outlives individual calls. Named threads ("sdk-blocking-N") make it
|
|
65
65
|
# distinguishable from Temporal's "activity-pool-N" threads in stack traces.
|
|
66
|
+
#
|
|
67
|
+
# Width is the stdlib's own default formula, ``min(32, cpus + 4)``, with the
|
|
68
|
+
# CPU count taken from the container's limit (``available_cpus``) rather than
|
|
69
|
+
# ``os.cpu_count()``, and never below 16. Without the floor a 1-CPU pod would
|
|
70
|
+
# drop from 32 threads to 5. These threads mostly wait on a database or the
|
|
71
|
+
# network rather than use CPU, so a wide fan-out of blocking calls would queue
|
|
72
|
+
# where it ran in parallel before. The floor still halves what a small pod on
|
|
73
|
+
# a big node got.
|
|
74
|
+
_MAX_BLOCKING_POOL_WIDTH = 32
|
|
75
|
+
_MIN_BLOCKING_POOL_WIDTH = 16
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _blocking_pool_width() -> int:
|
|
79
|
+
"""Threads in ``_BLOCKING_EXECUTOR``: ``min(32, max(16, available_cpus() + 4))``."""
|
|
80
|
+
return min(
|
|
81
|
+
_MAX_BLOCKING_POOL_WIDTH,
|
|
82
|
+
max(_MIN_BLOCKING_POOL_WIDTH, available_cpus() + 4),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
66
86
|
_BLOCKING_EXECUTOR = concurrent.futures.ThreadPoolExecutor(
|
|
67
|
-
max_workers=
|
|
87
|
+
max_workers=_blocking_pool_width(),
|
|
68
88
|
thread_name_prefix="sdk-blocking-",
|
|
69
89
|
)
|
|
70
90
|
|
|
@@ -526,9 +546,9 @@ def _auto_hold(label: str, timeout: float | None) -> Iterator[None]:
|
|
|
526
546
|
# the app's next calls queue behind them until the cap is reached. Unset (the
|
|
527
547
|
# default), nothing changes: calls queue
|
|
528
548
|
# exactly as before. A default cap would turn today's queueing into failures
|
|
529
|
-
# for any fan-out wider than the cap
|
|
530
|
-
#
|
|
531
|
-
#
|
|
549
|
+
# for any fan-out wider than the cap. The pool width now follows the pod's
|
|
550
|
+
# CPU limit, so a derived default would at least be sized right, but that
|
|
551
|
+
# does not change the first reason.
|
|
532
552
|
# * **A per-app stranded count**: calls whose caller stopped waiting while the
|
|
533
553
|
# thread kept running. Exported as the ``offload.stranded_threads`` gauge,
|
|
534
554
|
# labelled by app only, and logged once per strand with the callable's name.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"""Common utilities.
|
|
2
|
+
|
|
3
|
+
Most functions previously in this module have been moved to more logical homes:
|
|
4
|
+
|
|
5
|
+
- SQL filter pipeline → ``common.sql_filters``
|
|
6
|
+
- Credential parsing → ``credentials.utils``
|
|
7
|
+
- CPU/threading → ``common.concurrency``
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import warnings
|
|
12
|
+
|
|
13
|
+
import orjson
|
|
14
|
+
from pydantic import BaseModel
|
|
15
|
+
|
|
16
|
+
from application_sdk._context_errors import ObjectStoreNotConfiguredError
|
|
17
|
+
from application_sdk._install import worker_only_missing
|
|
18
|
+
from application_sdk._logging import get_logger
|
|
19
|
+
from application_sdk.constants import TEMPORARY_PATH
|
|
20
|
+
|
|
21
|
+
logger = get_logger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def download_file_from_upload_response(
|
|
25
|
+
response: dict | str | BaseModel,
|
|
26
|
+
) -> str:
|
|
27
|
+
"""Download a file that was uploaded via the /file endpoint.
|
|
28
|
+
|
|
29
|
+
Takes the upload response returned by the file upload endpoint (or its
|
|
30
|
+
dict/JSON representation) and downloads the file to a local temporary path
|
|
31
|
+
for processing in workflows or activities.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
response: The upload response containing the object store key. Can be
|
|
35
|
+
a dict, a JSON string, or any pydantic model with a ``key`` field —
|
|
36
|
+
:class:`application_sdk.handler.contracts.FileUploadResponse` (what
|
|
37
|
+
the handler's ``POST /workflows/v1/file`` returns) or the deprecated
|
|
38
|
+
``application_sdk.server.fastapi.models.FileUploadResponse``.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
The local file path where the file was downloaded.
|
|
42
|
+
|
|
43
|
+
Raises:
|
|
44
|
+
ValueError: If the input is a string that isn't valid JSON, or if
|
|
45
|
+
the ``key`` field is missing from the response.
|
|
46
|
+
"""
|
|
47
|
+
if isinstance(response, str):
|
|
48
|
+
try:
|
|
49
|
+
response = orjson.loads(response)
|
|
50
|
+
except orjson.JSONDecodeError as e:
|
|
51
|
+
from application_sdk.common.errors import JsonParseError # noqa: PLC0415
|
|
52
|
+
|
|
53
|
+
raise JsonParseError(cause=e) from e
|
|
54
|
+
|
|
55
|
+
if isinstance(response, BaseModel):
|
|
56
|
+
# Read the declared field, not getattr: a model without one is a type
|
|
57
|
+
# error, not a model whose key happens to be missing.
|
|
58
|
+
if "key" not in type(response).model_fields:
|
|
59
|
+
from application_sdk.common.errors import ResponseTypeError # noqa: PLC0415
|
|
60
|
+
|
|
61
|
+
raise ResponseTypeError(
|
|
62
|
+
message=f"Unsupported response type: {type(response).__name__}"
|
|
63
|
+
)
|
|
64
|
+
key = getattr(response, "key") # noqa: B009 — BaseModel declares no ``key``; checked above
|
|
65
|
+
# handler.contracts.FileUploadResponse defaults ``key`` to "": an unset
|
|
66
|
+
# key is a missing key, not a request to download the temp directory.
|
|
67
|
+
if not key:
|
|
68
|
+
from application_sdk.common.errors import ( # noqa: PLC0415
|
|
69
|
+
ResponseKeyMissingError,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
raise ResponseKeyMissingError()
|
|
73
|
+
elif isinstance(response, dict):
|
|
74
|
+
# Same rule as the model branch: the dict/JSON form of a handler
|
|
75
|
+
# response with no key carries ``"key": ""``.
|
|
76
|
+
if not response.get("key"):
|
|
77
|
+
from application_sdk.common.errors import ( # noqa: PLC0415
|
|
78
|
+
ResponseKeyMissingError,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
raise ResponseKeyMissingError()
|
|
82
|
+
key = response["key"]
|
|
83
|
+
else:
|
|
84
|
+
from application_sdk.common.errors import ResponseTypeError # noqa: PLC0415
|
|
85
|
+
|
|
86
|
+
raise ResponseTypeError(
|
|
87
|
+
message=f"Unsupported response type: {type(response).__name__}"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
local_path = os.path.join(TEMPORARY_PATH, key)
|
|
91
|
+
|
|
92
|
+
try:
|
|
93
|
+
from application_sdk.storage.ops import ( # noqa: PLC0415 — lazy: storage.ops imports obstore (heavy Rust ext) at module load, and this module sits on the workflow-sandbox import chain (credentials → here); pinned by the preflight gate's import-hygiene test
|
|
94
|
+
download_file_chunked,
|
|
95
|
+
)
|
|
96
|
+
except ModuleNotFoundError as exc:
|
|
97
|
+
if not worker_only_missing(exc):
|
|
98
|
+
raise
|
|
99
|
+
# api-only install (the API host): there is no object store to read from.
|
|
100
|
+
raise ObjectStoreNotConfiguredError() from exc
|
|
101
|
+
|
|
102
|
+
# Chunk large uploads (user-supplied files are uncapped) so a big artifact
|
|
103
|
+
# survives slow egress; small files still stream in a single GET. (BLDX-1513)
|
|
104
|
+
await download_file_chunked(
|
|
105
|
+
key=key,
|
|
106
|
+
local_path=local_path,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return local_path
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
#: name -> (replacement, why). Served by __getattr__ below (PEP 562).
|
|
113
|
+
_DEPRECATED_CONSTANTS: dict[str, tuple[str, str]] = {
|
|
114
|
+
"FileUploadResponse": (
|
|
115
|
+
"application_sdk.handler.contracts.FileUploadResponse",
|
|
116
|
+
"this module only ever re-exported the v2 "
|
|
117
|
+
"application_sdk.server.fastapi.models.FileUploadResponse, which is "
|
|
118
|
+
"itself deprecated",
|
|
119
|
+
),
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _deprecated_constant_value(name: str) -> object:
|
|
124
|
+
if name == "FileUploadResponse":
|
|
125
|
+
# Lazy: this module sits on the workflow-sandbox import chain
|
|
126
|
+
# (credentials → here) and must not pull the v2 server models in.
|
|
127
|
+
from application_sdk.server.fastapi.models import ( # noqa: PLC0415
|
|
128
|
+
FileUploadResponse,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return FileUploadResponse
|
|
132
|
+
raise AssertionError(name)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def __getattr__(name: str) -> object:
|
|
136
|
+
"""Serve the removed re-export once more, with a deprecation warning (PEP 562)."""
|
|
137
|
+
entry = _DEPRECATED_CONSTANTS.get(name)
|
|
138
|
+
if entry is None:
|
|
139
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
140
|
+
replacement, note = entry
|
|
141
|
+
warnings.warn(
|
|
142
|
+
f"{name} is deprecated; use {replacement} instead — {note}. "
|
|
143
|
+
"Will be removed in v4.0.",
|
|
144
|
+
DeprecationWarning,
|
|
145
|
+
stacklevel=2,
|
|
146
|
+
)
|
|
147
|
+
return _deprecated_constant_value(name)
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/constants.py
RENAMED
|
@@ -104,7 +104,7 @@ DOMAIN_NAME = os.getenv("ATLAN_DOMAIN_NAME", "atlan.com")
|
|
|
104
104
|
# The file is the *publish* path's half of the build identity FND-1684 already
|
|
105
105
|
# established for the e2e path as the ``ATLAN_BUILD_ID`` image ENV. Both answer
|
|
106
106
|
# "which build is this pod running?", so they are deliberately one contract with
|
|
107
|
-
# one reader (:func:`application_sdk.
|
|
107
|
+
# one reader (:func:`application_sdk.common.build_identity.build_identity`) rather
|
|
108
108
|
# than two: the file carries a ``build_id`` key holding the same immutable image
|
|
109
109
|
# tag the ENV carries, and the reader prefers the ENV so an e2e build stamped by
|
|
110
110
|
# ``.github/actions/build-app-image`` keeps reporting exactly what it reports
|
|
@@ -765,33 +765,87 @@ WORKER_EVICTION_MAX_RETRIES = _load_worker_eviction_max_retries()
|
|
|
765
765
|
#: activity is recorded and a positive window would kill a healthy worker.
|
|
766
766
|
#: Malformed or non-finite values (e.g. ``"abc"``, ``"inf"``, ``"nan"``) fall
|
|
767
767
|
#: back to 0.
|
|
768
|
-
def
|
|
769
|
-
|
|
768
|
+
def _load_non_negative_finite_float(name: str, default: float) -> float:
|
|
769
|
+
"""Read a non-negative, finite float env var, falling back to ``default``.
|
|
770
|
+
|
|
771
|
+
Malformed and non-finite values warn and fall back to ``default``; negative
|
|
772
|
+
values clamp to ``0``. Non-finite values are rejected because an ``inf``
|
|
773
|
+
bound is set but can never trip (``x > inf`` is always False), and ``nan``
|
|
774
|
+
comparisons are always False too — both are silently useless.
|
|
775
|
+
"""
|
|
776
|
+
raw = os.getenv(name)
|
|
777
|
+
if raw is None:
|
|
778
|
+
return default
|
|
770
779
|
try:
|
|
771
780
|
value = float(raw)
|
|
772
781
|
except ValueError:
|
|
773
782
|
warnings.warn(
|
|
774
|
-
f"
|
|
775
|
-
|
|
776
|
-
stacklevel=2,
|
|
783
|
+
f"{name}={raw!r} is not a valid number; falling back to {default:g}",
|
|
784
|
+
stacklevel=3,
|
|
777
785
|
)
|
|
778
|
-
return
|
|
779
|
-
# Reject inf/nan: an ``inf`` window is set but can never trip (``idle > inf``
|
|
780
|
-
# is always False), and ``nan`` comparisons are always False too — both are
|
|
781
|
-
# silently useless. Fall back to 0 (disabled) with a warning instead.
|
|
786
|
+
return default
|
|
782
787
|
if not math.isfinite(value):
|
|
783
788
|
warnings.warn(
|
|
784
|
-
f"
|
|
785
|
-
|
|
786
|
-
stacklevel=2,
|
|
789
|
+
f"{name}={raw!r} is not finite; falling back to {default:g}",
|
|
790
|
+
stacklevel=3,
|
|
787
791
|
)
|
|
788
|
-
return
|
|
792
|
+
return default
|
|
789
793
|
return max(0.0, value)
|
|
790
794
|
|
|
791
795
|
|
|
796
|
+
def _load_worker_liveness_max_idle_seconds() -> float:
|
|
797
|
+
return _load_non_negative_finite_float(
|
|
798
|
+
"ATLAN_WORKER_LIVENESS_MAX_IDLE_SECONDS", 0.0
|
|
799
|
+
)
|
|
800
|
+
|
|
801
|
+
|
|
792
802
|
WORKER_LIVENESS_MAX_IDLE_SECONDS = _load_worker_liveness_max_idle_seconds()
|
|
793
803
|
|
|
794
804
|
|
|
805
|
+
#: Consecutive definitive zero-poller readings after which the worker ``/live``
|
|
806
|
+
#: probe fails (FND-4641). sdk-core's ``temporal_num_pollers`` gauge reads zero
|
|
807
|
+
#: only when no poll loop is running; a legitimately idle worker still reads
|
|
808
|
+
#: its configured poller count, so unlike the idle window this does not
|
|
809
|
+
#: false-positive on a quiet queue. ``unknown`` readings (gauge unreadable)
|
|
810
|
+
#: never count. Readings come from the poll-state observer, so the wall-clock
|
|
811
|
+
#: time to trip is this count times ``ATLAN_WORKER_POLL_DIAGNOSTIC_INTERVAL_SECONDS``
|
|
812
|
+
#: (default 5 x 60s, about 5 minutes). ``0`` disables this check.
|
|
813
|
+
def _load_worker_liveness_max_zero_poller_readings() -> int:
|
|
814
|
+
# A reading count is a whole number. Parse it as one: a float parse would
|
|
815
|
+
# let ``0.5`` truncate to ``0`` and silently disable this default-on check,
|
|
816
|
+
# so any non-integer warns and keeps the default instead.
|
|
817
|
+
name = "ATLAN_WORKER_LIVENESS_MAX_ZERO_POLLER_READINGS"
|
|
818
|
+
default = 5
|
|
819
|
+
raw = os.getenv(name)
|
|
820
|
+
if raw is None:
|
|
821
|
+
return default
|
|
822
|
+
try:
|
|
823
|
+
value = int(raw)
|
|
824
|
+
except ValueError:
|
|
825
|
+
warnings.warn(
|
|
826
|
+
f"{name}={raw!r} is not a valid integer; falling back to {default}",
|
|
827
|
+
stacklevel=2,
|
|
828
|
+
)
|
|
829
|
+
return default
|
|
830
|
+
return max(0, value)
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
WORKER_LIVENESS_MAX_ZERO_POLLER_READINGS = (
|
|
834
|
+
_load_worker_liveness_max_zero_poller_readings()
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
#: Seconds the worker ``/live`` probe tolerates a fatal poll error with no sign
|
|
838
|
+
#: of recovery before it fails (FND-4641). Recovery means a later ``polling``
|
|
839
|
+
#: reading of sdk-core's poller gauge, which the in-process restart supervisor
|
|
840
|
+
#: produces once it rebuilds a worker that polls again. When the gauge cannot be
|
|
841
|
+
#: read (exporter or observer disabled) no recovery can be seen, so a fatal
|
|
842
|
+
#: always fails ``/live`` after this bound and the pod restarts. ``0`` disables
|
|
843
|
+
#: this check.
|
|
844
|
+
WORKER_LIVENESS_FATAL_RECOVERY_SECONDS = _load_non_negative_finite_float(
|
|
845
|
+
"ATLAN_WORKER_LIVENESS_FATAL_RECOVERY_SECONDS", 600.0
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
|
|
795
849
|
#: How long a worker whose pod already restarted waits before it starts polling.
|
|
796
850
|
#: The mechanism is in ``application_sdk.common.restart_marker``.
|
|
797
851
|
#:
|
|
@@ -1198,7 +1252,16 @@ SEGMENT_BATCH_TIMEOUT_SECONDS = float(
|
|
|
1198
1252
|
# Traces Configuration
|
|
1199
1253
|
#: Whether to register Temporal's OTel TracingInterceptor and emit spans.
|
|
1200
1254
|
#: Production does not yet support traces; default is False.
|
|
1255
|
+
#: The single read of ``ATLAN_ENABLE_OTLP_TRACES``: ``run_main``, the
|
|
1256
|
+
#: ``TraceInterceptor`` and the traces adapter all consult this constant.
|
|
1201
1257
|
ENABLE_OTLP_TRACES = os.getenv("ATLAN_ENABLE_OTLP_TRACES", "false").lower() == "true"
|
|
1258
|
+
#: Development only: also print every span to stdout via OTel's
|
|
1259
|
+
#: ``ConsoleSpanExporter``. Has no effect unless ``ENABLE_OTLP_TRACES`` is on.
|
|
1260
|
+
#: Default False — in a deployed pod it would serialise every span onto the
|
|
1261
|
+
#: log stream.
|
|
1262
|
+
ENABLE_TRACES_CONSOLE = (
|
|
1263
|
+
os.getenv("ATLAN_ENABLE_TRACES_CONSOLE", "false").lower() == "true"
|
|
1264
|
+
)
|
|
1202
1265
|
|
|
1203
1266
|
|
|
1204
1267
|
def _read_enable_tri_state(name: str) -> tuple[str | None, bool | None]:
|
|
@@ -6,6 +6,7 @@ import warnings
|
|
|
6
6
|
from typing import Any, Protocol, runtime_checkable
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel, ConfigDict
|
|
9
|
+
from typing_extensions import deprecated
|
|
9
10
|
|
|
10
11
|
from application_sdk._logging import get_logger
|
|
11
12
|
from application_sdk.credentials.spec import AgentCredentialSpec
|
|
@@ -57,11 +58,11 @@ class CredentialRef(BaseModel, frozen=True):
|
|
|
57
58
|
the bundle at ``secret-path`` via the injected
|
|
58
59
|
:class:`~application_sdk.infrastructure.secrets.SecretStore`,
|
|
59
60
|
substitutes ref-keys for real values, and returns the result.
|
|
60
|
-
* ``credential_guid`` non-empty →
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
* ``credential_guid`` non-empty → GUID resolution, the route every
|
|
62
|
+
direct-mode (non-agent) extraction takes. The resolver reads the
|
|
63
|
+
platform-issued credential through ``DaprCredentialVault``: the
|
|
64
|
+
non-secret config from the object store merged with its secrets
|
|
65
|
+
from the secret store.
|
|
65
66
|
* neither → named-path resolution via ``secret_store.get(name)``
|
|
66
67
|
with registry-based typed parsing.
|
|
67
68
|
"""
|
|
@@ -79,7 +80,7 @@ class CredentialRef(BaseModel, frozen=True):
|
|
|
79
80
|
"""Type identifier used to look up the parser in the registry
|
|
80
81
|
(e.g. ``"basic"``, ``"api_key"``).
|
|
81
82
|
|
|
82
|
-
Optional for the ``resolve_raw`` path (agent +
|
|
83
|
+
Optional for the ``resolve_raw`` path (agent + GUID both
|
|
83
84
|
return raw dicts regardless of type). Required for the typed
|
|
84
85
|
``resolve`` path — for agent refs the resolver falls back to the
|
|
85
86
|
``auth_type`` field on the spec when ``credential_type``
|
|
@@ -168,11 +169,7 @@ class CredentialRef(BaseModel, frozen=True):
|
|
|
168
169
|
|
|
169
170
|
guid = source.credential_guid or ""
|
|
170
171
|
if method in GUID_ROUTED_EXTRACTION_METHODS and guid:
|
|
171
|
-
return
|
|
172
|
-
name=guid,
|
|
173
|
-
credential_type="unknown",
|
|
174
|
-
credential_guid=guid,
|
|
175
|
-
)
|
|
172
|
+
return _guid_credential_ref(guid)
|
|
176
173
|
|
|
177
174
|
from application_sdk.credentials.errors import ( # noqa: PLC0415
|
|
178
175
|
CredentialRoutingError,
|
|
@@ -187,7 +184,7 @@ class CredentialRef(BaseModel, frozen=True):
|
|
|
187
184
|
Prefers a ref the source already carries on its ``credential_ref``
|
|
188
185
|
attribute; otherwise routes via :meth:`resolve`. Returns ``None`` when
|
|
189
186
|
the source carries no credential routing at all (e.g. a source-less app
|
|
190
|
-
input). On a routing/type error, falls back to a
|
|
187
|
+
input). On a routing/type error, falls back to a GUID ref when a
|
|
191
188
|
``credential_guid`` is present, else ``None``.
|
|
192
189
|
|
|
193
190
|
Shared by the extraction task path and the injected preflight gate so
|
|
@@ -211,10 +208,10 @@ class CredentialRef(BaseModel, frozen=True):
|
|
|
211
208
|
return cls.resolve(source)
|
|
212
209
|
except (CredentialResolvableTypeError, CredentialRoutingError):
|
|
213
210
|
logger.warning(
|
|
214
|
-
"CredentialRef.resolve failed; falling back to
|
|
211
|
+
"CredentialRef.resolve failed; falling back to GUID ref or None",
|
|
215
212
|
exc_info=True,
|
|
216
213
|
)
|
|
217
|
-
return
|
|
214
|
+
return _guid_credential_ref(guid) if guid else None
|
|
218
215
|
|
|
219
216
|
@classmethod
|
|
220
217
|
def from_workflow_args(cls, workflow_args: dict[str, Any]) -> CredentialRef:
|
|
@@ -237,9 +234,9 @@ class CredentialRef(BaseModel, frozen=True):
|
|
|
237
234
|
+=======================+=============+==================+=============+
|
|
238
235
|
| ``"agent"`` | populated | any | agent |
|
|
239
236
|
+-----------------------+-------------+------------------+-------------+
|
|
240
|
-
| ``"agent"`` | empty/``{}``| set |
|
|
237
|
+
| ``"agent"`` | empty/``{}``| set | GUID |
|
|
241
238
|
+-----------------------+-------------+------------------+-------------+
|
|
242
|
-
| anything else | any | set |
|
|
239
|
+
| anything else | any | set | GUID |
|
|
243
240
|
+-----------------------+-------------+------------------+-------------+
|
|
244
241
|
| (none applies) | | | ValueError |
|
|
245
242
|
+-----------------------+-------------+------------------+-------------+
|
|
@@ -358,19 +355,31 @@ def atlan_oauth_client_ref(name: str, *, store_name: str = "default") -> Credent
|
|
|
358
355
|
)
|
|
359
356
|
|
|
360
357
|
|
|
361
|
-
def
|
|
362
|
-
"""
|
|
358
|
+
def _guid_credential_ref(guid: str, credential_type: str = "unknown") -> CredentialRef:
|
|
359
|
+
"""Build the GUID-routed :class:`CredentialRef` for a platform-issued GUID.
|
|
363
360
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
361
|
+
The SDK's own constructor for the ``credential_guid`` route — used by
|
|
362
|
+
:meth:`CredentialRef.resolve`, :meth:`CredentialRef.resolve_or_none` and the
|
|
363
|
+
templates' fallback for an input that carries a GUID but no prebuilt
|
|
364
|
+
``credential_ref``. Private so the SDK can build a GUID ref without going
|
|
365
|
+
through the deprecated public :func:`legacy_credential_ref`.
|
|
367
366
|
"""
|
|
368
|
-
warnings.warn(
|
|
369
|
-
"legacy_credential_ref() is deprecated and will be removed in v4.0. "
|
|
370
|
-
"Use CredentialRef.resolve(input) instead.",
|
|
371
|
-
DeprecationWarning,
|
|
372
|
-
stacklevel=2,
|
|
373
|
-
)
|
|
374
367
|
return CredentialRef(
|
|
375
368
|
name=guid, credential_type=credential_type, credential_guid=guid
|
|
376
369
|
)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
@deprecated(
|
|
373
|
+
"legacy_credential_ref() is deprecated and will be removed in v4.0. "
|
|
374
|
+
"Use CredentialRef.resolve(input) instead.",
|
|
375
|
+
category=DeprecationWarning,
|
|
376
|
+
)
|
|
377
|
+
def legacy_credential_ref(guid: str, credential_type: str = "unknown") -> CredentialRef:
|
|
378
|
+
"""Create a CredentialRef from a platform-issued credential GUID.
|
|
379
|
+
|
|
380
|
+
.. deprecated::
|
|
381
|
+
Use :meth:`CredentialRef.resolve` instead, which routes a direct-mode
|
|
382
|
+
input to this same GUID ref. Removed in v4.0. The GUID route itself is
|
|
383
|
+
supported; only this public constructor is going away.
|
|
384
|
+
"""
|
|
385
|
+
return _guid_credential_ref(guid, credential_type)
|
|
@@ -1,41 +1,79 @@
|
|
|
1
|
-
|
|
1
|
+
"""Request/response DTOs of the v2 FastAPI server.
|
|
2
|
+
|
|
3
|
+
.. deprecated:: 3.56.0
|
|
4
|
+
Every model here is deprecated and removed in v4.0. The v2 server that
|
|
5
|
+
served them is gone; the v3 handler service owns those routes and their
|
|
6
|
+
typed contracts in :mod:`application_sdk.handler.contracts` (see each
|
|
7
|
+
model's notice for its replacement).
|
|
8
|
+
|
|
9
|
+
Nothing in the SDK imports this module. ``FileUploadResponse`` was the last
|
|
10
|
+
model in use, and :func:`application_sdk.common.utils.download_file_from_upload_response`
|
|
11
|
+
now takes any pydantic model with a ``key`` field instead
|
|
12
|
+
(:class:`application_sdk.handler.contracts.FileUploadResponse` is the one the
|
|
13
|
+
handler returns).
|
|
14
|
+
"""
|
|
2
15
|
|
|
3
16
|
from enum import Enum
|
|
4
17
|
from typing import Any, Callable, Coroutine, Dict, Optional, Union
|
|
5
18
|
|
|
6
19
|
from pydantic import BaseModel, Field, RootModel
|
|
20
|
+
from typing_extensions import deprecated
|
|
7
21
|
|
|
8
22
|
from application_sdk.contracts.events import Event
|
|
9
23
|
|
|
10
24
|
|
|
25
|
+
@deprecated(
|
|
26
|
+
"application_sdk.server.fastapi.models.TestAuthRequest is deprecated; use application_sdk.handler.contracts.AuthInput instead "
|
|
27
|
+
"— will be removed in v4.0."
|
|
28
|
+
)
|
|
11
29
|
class TestAuthRequest(RootModel[Dict[str, Any]]):
|
|
12
30
|
root: Dict[str, Any] = Field(
|
|
13
31
|
..., description="Root JSON object containing database credentials"
|
|
14
32
|
)
|
|
15
33
|
|
|
16
34
|
|
|
35
|
+
@deprecated(
|
|
36
|
+
"application_sdk.server.fastapi.models.TestAuthResponse is deprecated; use application_sdk.handler.contracts.AuthOutput instead "
|
|
37
|
+
"— will be removed in v4.0."
|
|
38
|
+
)
|
|
17
39
|
class TestAuthResponse(BaseModel):
|
|
18
40
|
success: bool
|
|
19
41
|
message: str
|
|
20
42
|
|
|
21
43
|
|
|
44
|
+
@deprecated(
|
|
45
|
+
"application_sdk.server.fastapi.models.MetadataType is deprecated; use application_sdk.handler.contracts.MetadataInput instead "
|
|
46
|
+
"— will be removed in v4.0."
|
|
47
|
+
)
|
|
22
48
|
class MetadataType(str, Enum):
|
|
23
49
|
DATABASE = "database"
|
|
24
50
|
SCHEMA = "schema"
|
|
25
51
|
ALL = "all"
|
|
26
52
|
|
|
27
53
|
|
|
54
|
+
@deprecated(
|
|
55
|
+
"application_sdk.server.fastapi.models.FetchMetadataRequest is deprecated; use application_sdk.handler.contracts.MetadataInput instead "
|
|
56
|
+
"— will be removed in v4.0."
|
|
57
|
+
)
|
|
28
58
|
class FetchMetadataRequest(RootModel[Dict[str, Any]]):
|
|
29
59
|
root: Dict[str, Any] = Field(
|
|
30
60
|
..., description="Root JSON object containing the metadata and credentials"
|
|
31
61
|
)
|
|
32
62
|
|
|
33
63
|
|
|
64
|
+
@deprecated(
|
|
65
|
+
"application_sdk.server.fastapi.models.FetchMetadataResponse is deprecated; use application_sdk.handler.contracts.MetadataOutput instead "
|
|
66
|
+
"— will be removed in v4.0."
|
|
67
|
+
)
|
|
34
68
|
class FetchMetadataResponse(BaseModel):
|
|
35
69
|
success: bool
|
|
36
70
|
data: Any
|
|
37
71
|
|
|
38
72
|
|
|
73
|
+
@deprecated(
|
|
74
|
+
"application_sdk.server.fastapi.models.PreflightCheckRequest is deprecated; use application_sdk.handler.contracts.PreflightInput instead "
|
|
75
|
+
"— will be removed in v4.0."
|
|
76
|
+
)
|
|
39
77
|
class PreflightCheckRequest(BaseModel):
|
|
40
78
|
model_config = {
|
|
41
79
|
"json_schema_extra": {
|
|
@@ -66,6 +104,10 @@ class PreflightCheckRequest(BaseModel):
|
|
|
66
104
|
)
|
|
67
105
|
|
|
68
106
|
|
|
107
|
+
@deprecated(
|
|
108
|
+
"application_sdk.server.fastapi.models.PreflightCheckResponse is deprecated; use application_sdk.handler.contracts.PreflightOutput instead "
|
|
109
|
+
"— will be removed in v4.0."
|
|
110
|
+
)
|
|
69
111
|
class PreflightCheckResponse(BaseModel):
|
|
70
112
|
model_config = {
|
|
71
113
|
"json_schema_extra": {
|
|
@@ -85,6 +127,11 @@ class PreflightCheckResponse(BaseModel):
|
|
|
85
127
|
data: Dict[str, Any] = Field(..., description="Response data")
|
|
86
128
|
|
|
87
129
|
|
|
130
|
+
@deprecated(
|
|
131
|
+
"application_sdk.server.fastapi.models.WorkflowRequest is deprecated; use the App's typed Input contract instead "
|
|
132
|
+
"(an application_sdk.contracts.base.Input subclass, which the handler's "
|
|
133
|
+
"/workflows/v1 routes accept) — will be removed in v4.0."
|
|
134
|
+
)
|
|
88
135
|
class WorkflowRequest(RootModel[Dict[str, Any]]):
|
|
89
136
|
model_config = {
|
|
90
137
|
"json_schema_extra": {
|
|
@@ -113,6 +160,10 @@ class WorkflowRequest(RootModel[Dict[str, Any]]):
|
|
|
113
160
|
)
|
|
114
161
|
|
|
115
162
|
|
|
163
|
+
@deprecated(
|
|
164
|
+
"application_sdk.server.fastapi.models.EventWorkflowRequest is deprecated; use application_sdk.handler.contracts.CloudEventEnvelope instead "
|
|
165
|
+
"— will be removed in v4.0."
|
|
166
|
+
)
|
|
116
167
|
class EventWorkflowRequest(BaseModel):
|
|
117
168
|
event: Event = Field(alias="data", description="Event object")
|
|
118
169
|
datacontenttype: str = Field(
|
|
@@ -126,12 +177,20 @@ class EventWorkflowRequest(BaseModel):
|
|
|
126
177
|
topic: str = Field(alias="topic", description="Event topic")
|
|
127
178
|
|
|
128
179
|
|
|
180
|
+
@deprecated(
|
|
181
|
+
"application_sdk.server.fastapi.models.WorkflowData is deprecated; use the handler's POST /workflows/v1/start response instead "
|
|
182
|
+
"(it carries workflow_id and run_id) — will be removed in v4.0."
|
|
183
|
+
)
|
|
129
184
|
class WorkflowData(BaseModel):
|
|
130
185
|
workflow_id: str = Field(..., description="Unique identifier for the workflow")
|
|
131
186
|
run_id: str = Field(..., description="Unique identifier for the workflow run")
|
|
132
187
|
|
|
133
188
|
|
|
134
|
-
class
|
|
189
|
+
class _WorkflowResponseFields(BaseModel):
|
|
190
|
+
# The fields WorkflowResponse and EventWorkflowResponse share. A private,
|
|
191
|
+
# undecorated base because subclassing a @deprecated class warns at class
|
|
192
|
+
# definition — EventWorkflowResponse(WorkflowResponse) would fire on every
|
|
193
|
+
# import of this module, not on use.
|
|
135
194
|
model_config = {
|
|
136
195
|
"json_schema_extra": {
|
|
137
196
|
"example": {
|
|
@@ -154,7 +213,19 @@ class WorkflowResponse(BaseModel):
|
|
|
154
213
|
data: WorkflowData = Field(..., description="Details about the workflow and run")
|
|
155
214
|
|
|
156
215
|
|
|
157
|
-
|
|
216
|
+
@deprecated(
|
|
217
|
+
"application_sdk.server.fastapi.models.WorkflowResponse is deprecated; use the handler's POST "
|
|
218
|
+
"/workflows/v1/start response instead — will be removed in v4.0."
|
|
219
|
+
)
|
|
220
|
+
class WorkflowResponse(_WorkflowResponseFields):
|
|
221
|
+
"""Response of the v2 server's workflow-start route."""
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@deprecated(
|
|
225
|
+
"application_sdk.server.fastapi.models.EventWorkflowResponse is deprecated; use the handler's "
|
|
226
|
+
"/events/v1/event/{event_id} route instead — will be removed in v4.0."
|
|
227
|
+
)
|
|
228
|
+
class EventWorkflowResponse(_WorkflowResponseFields):
|
|
158
229
|
class Status(str, Enum):
|
|
159
230
|
SUCCESS = "SUCCESS"
|
|
160
231
|
RETRY = "RETRY"
|
|
@@ -165,12 +236,21 @@ class EventWorkflowResponse(WorkflowResponse):
|
|
|
165
236
|
status: Status = Field(..., description="Status of the workflow")
|
|
166
237
|
|
|
167
238
|
|
|
239
|
+
@deprecated(
|
|
240
|
+
"application_sdk.server.fastapi.models.WorkflowConfigRequest is deprecated; use the App's typed Input contract instead "
|
|
241
|
+
"(an application_sdk.contracts.base.Input subclass, which the handler's "
|
|
242
|
+
"/workflows/v1 routes accept) — will be removed in v4.0."
|
|
243
|
+
)
|
|
168
244
|
class WorkflowConfigRequest(RootModel[Dict[str, Any]]):
|
|
169
245
|
root: Dict[str, Any] = Field(
|
|
170
246
|
..., description="Root JSON object containing workflow configuration"
|
|
171
247
|
)
|
|
172
248
|
|
|
173
249
|
|
|
250
|
+
@deprecated(
|
|
251
|
+
"application_sdk.server.fastapi.models.WorkflowConfigResponse is deprecated; use the handler's GET /workflows/v1/config/{config_id} route instead "
|
|
252
|
+
"— will be removed in v4.0."
|
|
253
|
+
)
|
|
174
254
|
class WorkflowConfigResponse(BaseModel):
|
|
175
255
|
model_config = {
|
|
176
256
|
"json_schema_extra": {
|
|
@@ -199,6 +279,10 @@ class WorkflowConfigResponse(BaseModel):
|
|
|
199
279
|
data: Dict[str, Any] = Field(..., description="Workflow configuration")
|
|
200
280
|
|
|
201
281
|
|
|
282
|
+
@deprecated(
|
|
283
|
+
"application_sdk.server.fastapi.models.ConfigMapResponse is deprecated; use the handler's GET /workflows/v1/configmap/{config_map_id} route instead "
|
|
284
|
+
"— will be removed in v4.0."
|
|
285
|
+
)
|
|
202
286
|
class ConfigMapResponse(BaseModel):
|
|
203
287
|
model_config = {
|
|
204
288
|
"json_schema_extra": {
|
|
@@ -227,6 +311,10 @@ class ConfigMapResponse(BaseModel):
|
|
|
227
311
|
data: Dict[str, Any] = Field(..., description="Configuration map object")
|
|
228
312
|
|
|
229
313
|
|
|
314
|
+
@deprecated(
|
|
315
|
+
"application_sdk.server.fastapi.models.Subscription is deprecated; use application_sdk.handler.contracts.SubscriptionConfig instead "
|
|
316
|
+
"— will be removed in v4.0."
|
|
317
|
+
)
|
|
230
318
|
class Subscription(BaseModel):
|
|
231
319
|
"""Subscription configuration for Dapr messaging.
|
|
232
320
|
|
|
@@ -288,6 +376,10 @@ class Subscription(BaseModel):
|
|
|
288
376
|
dead_letter_topic: Optional[str] = None
|
|
289
377
|
|
|
290
378
|
|
|
379
|
+
@deprecated(
|
|
380
|
+
"application_sdk.server.fastapi.models.FileUploadResponse is deprecated; use application_sdk.handler.contracts.FileUploadResponse instead "
|
|
381
|
+
"(snake_case attributes, serialised with the same camelCase aliases) — will be removed in v4.0."
|
|
382
|
+
)
|
|
291
383
|
class FileUploadResponse(BaseModel):
|
|
292
384
|
"""Response model for file upload endpoint matching heracles format.
|
|
293
385
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "atlan-application-sdk-api"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.56.0"
|
|
4
4
|
description = "Experimental: the handler surface of the Atlan Application SDK, for the consolidated API host"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
authors = [
|
|
@@ -61,7 +61,7 @@ pyatlan = [
|
|
|
61
61
|
# pyatlan 11.5.0 already requires authlib~=1.9.1 on Python >=3.10. Published
|
|
62
62
|
# here too so a resolver that ignores requires-python cannot pick pyatlan's
|
|
63
63
|
# py3.9 authlib branch for this wheel.
|
|
64
|
-
"authlib>=1.9.
|
|
64
|
+
"authlib>=1.9.5,<2", # CVE-2026-96760
|
|
65
65
|
]
|
|
66
66
|
|
|
67
67
|
[project.urls]
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"""Common utilities.
|
|
2
|
-
|
|
3
|
-
Most functions previously in this module have been moved to more logical homes:
|
|
4
|
-
|
|
5
|
-
- SQL filter pipeline → ``common.sql_filters``
|
|
6
|
-
- Credential parsing → ``credentials.utils``
|
|
7
|
-
- CPU/threading → ``common.concurrency``
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
import os
|
|
11
|
-
|
|
12
|
-
import orjson
|
|
13
|
-
|
|
14
|
-
from application_sdk._context_errors import ObjectStoreNotConfiguredError
|
|
15
|
-
from application_sdk._install import worker_only_missing
|
|
16
|
-
from application_sdk._logging import get_logger
|
|
17
|
-
from application_sdk.constants import TEMPORARY_PATH
|
|
18
|
-
from application_sdk.server.fastapi.models import FileUploadResponse
|
|
19
|
-
|
|
20
|
-
logger = get_logger(__name__)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
async def download_file_from_upload_response(
|
|
24
|
-
response: dict | str | FileUploadResponse,
|
|
25
|
-
) -> str:
|
|
26
|
-
"""Download a file that was uploaded via the /file endpoint.
|
|
27
|
-
|
|
28
|
-
Takes the FileUploadResponse (or its dict/JSON representation) returned by
|
|
29
|
-
the file upload endpoint and downloads the file to a local temporary path
|
|
30
|
-
for processing in workflows or activities.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
response: The upload response containing the object store key.
|
|
34
|
-
Can be a dict, a JSON string, or a FileUploadResponse object.
|
|
35
|
-
|
|
36
|
-
Returns:
|
|
37
|
-
The local file path where the file was downloaded.
|
|
38
|
-
|
|
39
|
-
Raises:
|
|
40
|
-
ValueError: If the input is a string that isn't valid JSON, or if
|
|
41
|
-
the ``key`` field is missing from the response.
|
|
42
|
-
"""
|
|
43
|
-
if isinstance(response, str):
|
|
44
|
-
try:
|
|
45
|
-
response = orjson.loads(response)
|
|
46
|
-
except orjson.JSONDecodeError as e:
|
|
47
|
-
from application_sdk.common.errors import JsonParseError # noqa: PLC0415
|
|
48
|
-
|
|
49
|
-
raise JsonParseError(cause=e) from e
|
|
50
|
-
|
|
51
|
-
if isinstance(response, FileUploadResponse):
|
|
52
|
-
key = response.key
|
|
53
|
-
elif isinstance(response, dict):
|
|
54
|
-
if "key" not in response:
|
|
55
|
-
from application_sdk.common.errors import ( # noqa: PLC0415
|
|
56
|
-
ResponseKeyMissingError,
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
raise ResponseKeyMissingError()
|
|
60
|
-
key = response["key"]
|
|
61
|
-
else:
|
|
62
|
-
from application_sdk.common.errors import ResponseTypeError # noqa: PLC0415
|
|
63
|
-
|
|
64
|
-
raise ResponseTypeError(
|
|
65
|
-
message=f"Unsupported response type: {type(response).__name__}"
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
local_path = os.path.join(TEMPORARY_PATH, key)
|
|
69
|
-
|
|
70
|
-
try:
|
|
71
|
-
from application_sdk.storage.ops import ( # noqa: PLC0415 — lazy: storage.ops imports obstore (heavy Rust ext) at module load, and this module sits on the workflow-sandbox import chain (credentials → here); pinned by the preflight gate's import-hygiene test
|
|
72
|
-
download_file_chunked,
|
|
73
|
-
)
|
|
74
|
-
except ModuleNotFoundError as exc:
|
|
75
|
-
if not worker_only_missing(exc):
|
|
76
|
-
raise
|
|
77
|
-
# api-only install (the API host): there is no object store to read from.
|
|
78
|
-
raise ObjectStoreNotConfiguredError() from exc
|
|
79
|
-
|
|
80
|
-
# Chunk large uploads (user-supplied files are uncapped) so a big artifact
|
|
81
|
-
# survives slow egress; small files still stream in a single GET. (BLDX-1513)
|
|
82
|
-
await download_file_chunked(
|
|
83
|
-
key=key,
|
|
84
|
-
local_path=local_path,
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
return local_path
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_install.py
RENAMED
|
File without changes
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/_logging.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/clients/sql.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/base.py
RENAMED
|
File without changes
|
|
File without changes
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/http.py
RENAMED
|
File without changes
|
|
File without changes
|
{atlan_application_sdk_api-3.55.3 → atlan_application_sdk_api-3.56.0}/application_sdk/errors/wire.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|