atlan-application-sdk 0.1.1rc60__py3-none-any.whl → 0.1.1rc62__py3-none-any.whl
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.
- application_sdk/clients/temporal.py +44 -0
- application_sdk/constants.py +11 -5
- application_sdk/events/models.py +24 -0
- application_sdk/version.py +1 -1
- {atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/METADATA +2 -2
- {atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/RECORD +9 -9
- {atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/WHEEL +0 -0
- {atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/licenses/LICENSE +0 -0
- {atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/licenses/NOTICE +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import time
|
|
2
3
|
import uuid
|
|
3
4
|
from concurrent.futures import ThreadPoolExecutor
|
|
4
5
|
from typing import Any, Dict, Optional, Sequence, Type
|
|
@@ -26,10 +27,17 @@ from application_sdk.constants import (
|
|
|
26
27
|
WORKFLOW_PORT,
|
|
27
28
|
WORKFLOW_TLS_ENABLED_KEY,
|
|
28
29
|
)
|
|
30
|
+
from application_sdk.events.models import (
|
|
31
|
+
ApplicationEventNames,
|
|
32
|
+
Event,
|
|
33
|
+
EventTypes,
|
|
34
|
+
WorkerTokenRefreshEventData,
|
|
35
|
+
)
|
|
29
36
|
from application_sdk.interceptors.cleanup import CleanupInterceptor, cleanup
|
|
30
37
|
from application_sdk.interceptors.events import EventInterceptor, publish_event
|
|
31
38
|
from application_sdk.interceptors.lock import RedisLockInterceptor
|
|
32
39
|
from application_sdk.observability.logger_adaptor import get_logger
|
|
40
|
+
from application_sdk.services.eventstore import EventStore
|
|
33
41
|
from application_sdk.services.secretstore import SecretStore
|
|
34
42
|
from application_sdk.services.statestore import StateStore, StateType
|
|
35
43
|
from application_sdk.workflows import WorkflowInterface
|
|
@@ -142,6 +150,39 @@ class TemporalWorkflowClient(WorkflowClient):
|
|
|
142
150
|
"""
|
|
143
151
|
return self.namespace
|
|
144
152
|
|
|
153
|
+
async def _publish_token_refresh_event(self) -> None:
|
|
154
|
+
"""Publish a token refresh event to the event store.
|
|
155
|
+
|
|
156
|
+
This method creates and publishes an event containing token refresh information,
|
|
157
|
+
including application name, deployment name, token expiry times, and refresh timestamp.
|
|
158
|
+
If event publishing fails, it logs a warning but does not raise an exception to avoid
|
|
159
|
+
disrupting the token refresh loop.
|
|
160
|
+
|
|
161
|
+
Note:
|
|
162
|
+
This method handles exceptions internally and will not propagate errors,
|
|
163
|
+
ensuring the token refresh loop continues even if event publishing fails.
|
|
164
|
+
"""
|
|
165
|
+
try:
|
|
166
|
+
current_time = time.time()
|
|
167
|
+
worker_token_refresh_data = WorkerTokenRefreshEventData(
|
|
168
|
+
application_name=self.application_name,
|
|
169
|
+
deployment_name=DEPLOYMENT_NAME,
|
|
170
|
+
force_refresh=True,
|
|
171
|
+
token_expiry_time=self.auth_manager.get_token_expiry_time() or 0,
|
|
172
|
+
time_until_expiry=self.auth_manager.get_time_until_expiry() or 0,
|
|
173
|
+
refresh_timestamp=current_time,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
event = Event(
|
|
177
|
+
event_type=EventTypes.APPLICATION_EVENT.value,
|
|
178
|
+
event_name=ApplicationEventNames.TOKEN_REFRESH.value,
|
|
179
|
+
data=worker_token_refresh_data.model_dump(),
|
|
180
|
+
)
|
|
181
|
+
await EventStore.publish_event(event)
|
|
182
|
+
logger.info("Published token refresh event")
|
|
183
|
+
except Exception as e:
|
|
184
|
+
logger.warning(f"Failed to publish token refresh event: {e}")
|
|
185
|
+
|
|
145
186
|
async def _token_refresh_loop(self) -> None:
|
|
146
187
|
"""Background loop that refreshes the authentication token dynamically."""
|
|
147
188
|
while True:
|
|
@@ -161,6 +202,9 @@ class TemporalWorkflowClient(WorkflowClient):
|
|
|
161
202
|
self._token_refresh_interval = (
|
|
162
203
|
self.auth_manager.calculate_refresh_interval()
|
|
163
204
|
)
|
|
205
|
+
# Publish token refresh event
|
|
206
|
+
await self._publish_token_refresh_event()
|
|
207
|
+
|
|
164
208
|
except asyncio.CancelledError:
|
|
165
209
|
logger.info("Token refresh loop cancelled")
|
|
166
210
|
break
|
application_sdk/constants.py
CHANGED
|
@@ -51,7 +51,9 @@ SQL_SERVER_MIN_VERSION = os.getenv("ATLAN_SQL_SERVER_MIN_VERSION")
|
|
|
51
51
|
SQL_QUERIES_PATH = os.getenv("ATLAN_SQL_QUERIES_PATH", "app/sql")
|
|
52
52
|
|
|
53
53
|
# Output Path Constants
|
|
54
|
-
#: Output path format for workflows
|
|
54
|
+
#: Output path format for workflows.
|
|
55
|
+
#:
|
|
56
|
+
#: Example: objectstore://bucket/artifacts/apps/{application_name}/workflows/{workflow_id}/{workflow_run_id}
|
|
55
57
|
WORKFLOW_OUTPUT_PATH_TEMPLATE = (
|
|
56
58
|
"artifacts/apps/{application_name}/workflows/{workflow_id}/{run_id}"
|
|
57
59
|
)
|
|
@@ -68,7 +70,9 @@ CLEANUP_BASE_PATHS = [
|
|
|
68
70
|
]
|
|
69
71
|
|
|
70
72
|
# State Store Constants
|
|
71
|
-
#: Path template for state store files
|
|
73
|
+
#: Path template for state store files.
|
|
74
|
+
#:
|
|
75
|
+
#: Example: objectstore://bucket/persistent-artifacts/apps/{application_name}/{state_type}/{id}/config.json
|
|
72
76
|
STATE_STORE_PATH_TEMPLATE = (
|
|
73
77
|
"persistent-artifacts/apps/{application_name}/{state_type}/{id}/config.json"
|
|
74
78
|
)
|
|
@@ -147,7 +151,9 @@ WORKER_START_EVENT_VERSION = "v1"
|
|
|
147
151
|
#: Whether to enable Atlan storage upload
|
|
148
152
|
ENABLE_ATLAN_UPLOAD = os.getenv("ENABLE_ATLAN_UPLOAD", "false").lower() == "true"
|
|
149
153
|
# Dapr Client Configuration
|
|
150
|
-
#: Maximum gRPC message length in bytes for Dapr client
|
|
154
|
+
#: Maximum gRPC message length in bytes for Dapr client.
|
|
155
|
+
#:
|
|
156
|
+
#: Default: 100MB
|
|
151
157
|
DAPR_MAX_GRPC_MESSAGE_LENGTH = int(
|
|
152
158
|
os.getenv("DAPR_MAX_GRPC_MESSAGE_LENGTH", "104857600")
|
|
153
159
|
)
|
|
@@ -250,9 +256,9 @@ REDIS_HOST = os.getenv("REDIS_HOST", "")
|
|
|
250
256
|
REDIS_PORT = os.getenv("REDIS_PORT", "")
|
|
251
257
|
#: Redis password (required for authenticated Redis instances)
|
|
252
258
|
REDIS_PASSWORD = os.getenv("REDIS_PASSWORD")
|
|
253
|
-
#: Redis Sentinel service name
|
|
259
|
+
#: Redis Sentinel service name. Default: mymaster
|
|
254
260
|
REDIS_SENTINEL_SERVICE_NAME = os.getenv("REDIS_SENTINEL_SERVICE_NAME", "mymaster")
|
|
255
|
-
#: Redis Sentinel hosts
|
|
261
|
+
#: Redis Sentinel hosts as comma-separated host:port pairs
|
|
256
262
|
REDIS_SENTINEL_HOSTS = os.getenv("REDIS_SENTINEL_HOSTS", "")
|
|
257
263
|
#: Whether to enable strict locking
|
|
258
264
|
IS_LOCKING_DISABLED = os.getenv("IS_LOCKING_DISABLED", "true").lower() == "true"
|
application_sdk/events/models.py
CHANGED
|
@@ -29,6 +29,7 @@ class ApplicationEventNames(Enum):
|
|
|
29
29
|
WORKER_END = "worker_end"
|
|
30
30
|
APPLICATION_START = "application_start"
|
|
31
31
|
APPLICATION_END = "application_end"
|
|
32
|
+
TOKEN_REFRESH = "token_refresh"
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
class WorkflowStates(Enum):
|
|
@@ -174,3 +175,26 @@ class WorkerStartEventData(BaseModel):
|
|
|
174
175
|
max_concurrent_activities: Optional[int]
|
|
175
176
|
workflow_count: int
|
|
176
177
|
activity_count: int
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class WorkerTokenRefreshEventData(BaseModel):
|
|
181
|
+
"""Model for token refresh event data.
|
|
182
|
+
|
|
183
|
+
This model represents the data structure used when publishing token refresh events.
|
|
184
|
+
It contains information about the token refresh operation and agent status.
|
|
185
|
+
|
|
186
|
+
Attributes:
|
|
187
|
+
application_name: Name of the application the token belongs to.
|
|
188
|
+
deployment_name: Name of the deployment (e.g., dev, staging, prod).
|
|
189
|
+
force_refresh: Whether this was a forced refresh or automatic.
|
|
190
|
+
token_expiry_time: Unix timestamp when the new token expires.
|
|
191
|
+
time_until_expiry: Seconds until token expires.
|
|
192
|
+
refresh_timestamp: Unix timestamp when the refresh occurred.
|
|
193
|
+
"""
|
|
194
|
+
|
|
195
|
+
application_name: str
|
|
196
|
+
deployment_name: str
|
|
197
|
+
force_refresh: bool
|
|
198
|
+
token_expiry_time: float
|
|
199
|
+
time_until_expiry: float
|
|
200
|
+
refresh_timestamp: float
|
application_sdk/version.py
CHANGED
{atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: atlan-application-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1rc62
|
|
4
4
|
Summary: Atlan Application SDK is a Python library for developing applications on the Atlan Platform
|
|
5
5
|
Project-URL: Repository, https://github.com/atlanhq/application-sdk
|
|
6
6
|
Project-URL: Documentation, https://github.com/atlanhq/application-sdk/README.md
|
|
@@ -22,7 +22,7 @@ Requires-Python: >=3.11
|
|
|
22
22
|
Requires-Dist: aiohttp>=3.10.0
|
|
23
23
|
Requires-Dist: duckdb-engine>=0.17.0
|
|
24
24
|
Requires-Dist: duckdb>=1.1.3
|
|
25
|
-
Requires-Dist: fastapi[standard]
|
|
25
|
+
Requires-Dist: fastapi[standard]==0.120.2
|
|
26
26
|
Requires-Dist: loguru>=0.7.3
|
|
27
27
|
Requires-Dist: opentelemetry-exporter-otlp>=1.27.0
|
|
28
28
|
Requires-Dist: psutil>=7.0.0
|
{atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
application_sdk/__init__.py,sha256=2e2mvmLJ5dxmJGPELtb33xwP-j6JMdoIuqKycEn7hjg,151
|
|
2
|
-
application_sdk/constants.py,sha256=
|
|
3
|
-
application_sdk/version.py,sha256=
|
|
2
|
+
application_sdk/constants.py,sha256=XCRJRiug2GXgeeVZu3Mp1QavRw54bWtzxIZ2l1bIkkA,11028
|
|
3
|
+
application_sdk/version.py,sha256=MFOV2tNUAo7go0hrgOky6QW0SxSDPfPaY9aTrIZC3wg,88
|
|
4
4
|
application_sdk/worker.py,sha256=i5f0AeKI39IfsLO05QkwC6uMz0zDPSJqP7B2byri1VI,7489
|
|
5
5
|
application_sdk/activities/__init__.py,sha256=L5WXkTwOwGtjWAlXrUJRCKGwyIyp3z8fBv8BZVCRFQI,11175
|
|
6
6
|
application_sdk/activities/lock_management.py,sha256=6Wdf3jMKitoarHQP91PIJOoGFz4aaOLS_40c7n1yAOA,3902
|
|
@@ -23,7 +23,7 @@ application_sdk/clients/base.py,sha256=TIn3pG89eXUc1XSYf4jk66m1vajWp0WxcCQOOltda
|
|
|
23
23
|
application_sdk/clients/models.py,sha256=iZOTyH6LO64kozdiUPCFCN0NgLhd_Gtv0lH7ZIPdo8w,1800
|
|
24
24
|
application_sdk/clients/redis.py,sha256=IfAD32vLp88BCvsDTaQtxFHxzHlEx4V7TK7h1HwDDBg,15917
|
|
25
25
|
application_sdk/clients/sql.py,sha256=lXeVu_dute30IaWWK5gHBhjEs2dXp_e0XkOMsbOsq64,19589
|
|
26
|
-
application_sdk/clients/temporal.py,sha256=
|
|
26
|
+
application_sdk/clients/temporal.py,sha256=eSbBOmbRmYU-MLiQ1D8hHTU3-VIJssTYAzC2twLwf38,20200
|
|
27
27
|
application_sdk/clients/utils.py,sha256=zLFOJbTr_6TOqnjfVFGY85OtIXZ4FQy_rquzjaydkbY,779
|
|
28
28
|
application_sdk/clients/workflow.py,sha256=6bSqmA3sNCk9oY68dOjBUDZ9DhNKQxPD75qqE0cfldc,6104
|
|
29
29
|
application_sdk/clients/.cursor/BUGBOT.md,sha256=7nEDUqWBEMI_uU6eK1jCSZGeXoQtLQcKwOrDn8AIDWo,10595
|
|
@@ -55,7 +55,7 @@ application_sdk/docgen/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
|
55
55
|
application_sdk/docgen/parsers/directory.py,sha256=8Kk2sjb-0l2wLO_njdlcuHjv5akoNgmf-FmaDSaE4WM,7751
|
|
56
56
|
application_sdk/docgen/parsers/manifest.py,sha256=3NP-dBTpHAUQa477usMIDaKSb_9xfLE8G3RX0T1Bq2s,3318
|
|
57
57
|
application_sdk/events/__init__.py,sha256=OcbVWDF4ZKRTJXK9UaFVtYEwu-3DHE77S-Sn6jNafUs,204
|
|
58
|
-
application_sdk/events/models.py,sha256=
|
|
58
|
+
application_sdk/events/models.py,sha256=Q8qt1lW0XimtNI2GFd9o6kO3xOuPt9c8yFqzZJVKCv8,6019
|
|
59
59
|
application_sdk/handlers/__init__.py,sha256=3Wf7jCVFR2nYOyHZEc9jj8BQUnHCylFqoezp70J2Df0,1329
|
|
60
60
|
application_sdk/handlers/base.py,sha256=ieWFbv8Gm7vfrrpS-mdMSm-mHGuQY02qiAVX2qPdj3w,2467
|
|
61
61
|
application_sdk/handlers/sql.py,sha256=6A_9xCtkXyNY5gPhImbftzrdPIEWIeTTqjyIewVESHA,17815
|
|
@@ -157,8 +157,8 @@ application_sdk/workflows/metadata_extraction/__init__.py,sha256=jHUe_ZBQ66jx8bg
|
|
|
157
157
|
application_sdk/workflows/metadata_extraction/sql.py,sha256=6ZaVt84n-8U2ZvR9GR7uIJKv5v8CuyQjhlnoRJvDszc,12435
|
|
158
158
|
application_sdk/workflows/query_extraction/__init__.py,sha256=n066_CX5RpJz6DIxGMkKS3eGSRg03ilaCtsqfJWQb7Q,117
|
|
159
159
|
application_sdk/workflows/query_extraction/sql.py,sha256=kT_JQkLCRZ44ZpaC4QvPL6DxnRIIVh8gYHLqRbMI-hA,4826
|
|
160
|
-
atlan_application_sdk-0.1.
|
|
161
|
-
atlan_application_sdk-0.1.
|
|
162
|
-
atlan_application_sdk-0.1.
|
|
163
|
-
atlan_application_sdk-0.1.
|
|
164
|
-
atlan_application_sdk-0.1.
|
|
160
|
+
atlan_application_sdk-0.1.1rc62.dist-info/METADATA,sha256=8ApEAfPm6ZpGgjwZtDJ2F_rqLkNCM5L-3ZKTKkdkwJg,5730
|
|
161
|
+
atlan_application_sdk-0.1.1rc62.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
162
|
+
atlan_application_sdk-0.1.1rc62.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
163
|
+
atlan_application_sdk-0.1.1rc62.dist-info/licenses/NOTICE,sha256=A-XVVGt3KOYuuMmvSMIFkg534F1vHiCggEBp4Ez3wGk,1041
|
|
164
|
+
atlan_application_sdk-0.1.1rc62.dist-info/RECORD,,
|
{atlan_application_sdk-0.1.1rc60.dist-info → atlan_application_sdk-0.1.1rc62.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|