durabletask.azuremanaged 1.4.0.dev33__tar.gz → 1.5.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.
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/PKG-INFO +3 -3
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask/azuremanaged/client.py +32 -24
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask/azuremanaged/internal/access_token_manager.py +6 -7
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask/azuremanaged/internal/durabletask_grpc_interceptor.py +5 -8
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask/azuremanaged/worker.py +22 -16
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask.azuremanaged.egg-info/PKG-INFO +3 -3
- durabletask_azuremanaged-1.5.0/durabletask.azuremanaged.egg-info/requires.txt +5 -0
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/pyproject.toml +3 -3
- durabletask_azuremanaged-1.4.0.dev33/durabletask.azuremanaged.egg-info/requires.txt +0 -5
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask/azuremanaged/__init__.py +0 -0
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask/azuremanaged/internal/py.typed +0 -0
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask/azuremanaged/py.typed +0 -0
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask.azuremanaged.egg-info/SOURCES.txt +0 -0
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask.azuremanaged.egg-info/dependency_links.txt +0 -0
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/durabletask.azuremanaged.egg-info/top_level.txt +0 -0
- {durabletask_azuremanaged-1.4.0.dev33 → durabletask_azuremanaged-1.5.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: durabletask.azuremanaged
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Durable Task Python SDK provider implementation for the Azure Durable Task Scheduler
|
|
5
5
|
Project-URL: repository, https://github.com/microsoft/durabletask-python
|
|
6
6
|
Project-URL: changelog, https://github.com/microsoft/durabletask-python/blob/main/CHANGELOG.md
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: durabletask>=1.
|
|
13
|
+
Requires-Dist: durabletask>=1.5.0
|
|
14
14
|
Requires-Dist: azure-identity>=1.19.0
|
|
15
15
|
Provides-Extra: azure-blob-payloads
|
|
16
|
-
Requires-Dist: durabletask[azure-blob-payloads]>=1.
|
|
16
|
+
Requires-Dist: durabletask[azure-blob-payloads]>=1.5.0; extra == "azure-blob-payloads"
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
# Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import logging
|
|
5
|
-
|
|
6
|
-
from typing import Optional, Sequence
|
|
5
|
+
from collections.abc import Sequence
|
|
7
6
|
|
|
8
7
|
import grpc
|
|
9
8
|
import grpc.aio
|
|
@@ -15,7 +14,10 @@ from durabletask.azuremanaged.internal.durabletask_grpc_interceptor import (
|
|
|
15
14
|
DTSDefaultClientInterceptorImpl,
|
|
16
15
|
)
|
|
17
16
|
from durabletask.client import AsyncTaskHubGrpcClient, TaskHubGrpcClient
|
|
18
|
-
from durabletask.grpc_options import
|
|
17
|
+
from durabletask.grpc_options import (
|
|
18
|
+
GrpcChannelOptions,
|
|
19
|
+
GrpcClientResiliencyOptions,
|
|
20
|
+
)
|
|
19
21
|
import durabletask.internal.shared as shared
|
|
20
22
|
from durabletask.payload.store import PayloadStore
|
|
21
23
|
|
|
@@ -25,15 +27,16 @@ class DurableTaskSchedulerClient(TaskHubGrpcClient):
|
|
|
25
27
|
def __init__(self, *,
|
|
26
28
|
host_address: str,
|
|
27
29
|
taskhub: str,
|
|
28
|
-
token_credential:
|
|
29
|
-
channel:
|
|
30
|
+
token_credential: TokenCredential | None,
|
|
31
|
+
channel: grpc.Channel | None = None,
|
|
30
32
|
secure_channel: bool = True,
|
|
31
|
-
interceptors:
|
|
32
|
-
channel_options:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
interceptors: Sequence[shared.ClientInterceptor] | None = None,
|
|
34
|
+
channel_options: GrpcChannelOptions | None = None,
|
|
35
|
+
resiliency_options: GrpcClientResiliencyOptions | None = None,
|
|
36
|
+
default_version: str | None = None,
|
|
37
|
+
payload_store: PayloadStore | None = None,
|
|
38
|
+
log_handler: logging.Handler | None = None,
|
|
39
|
+
log_formatter: logging.Formatter | None = None):
|
|
37
40
|
|
|
38
41
|
if not taskhub:
|
|
39
42
|
raise ValueError("Taskhub value cannot be empty. Please provide a value for your taskhub")
|
|
@@ -54,6 +57,7 @@ class DurableTaskSchedulerClient(TaskHubGrpcClient):
|
|
|
54
57
|
log_formatter=log_formatter,
|
|
55
58
|
interceptors=resolved_interceptors,
|
|
56
59
|
channel_options=channel_options,
|
|
60
|
+
resiliency_options=resiliency_options,
|
|
57
61
|
default_version=default_version,
|
|
58
62
|
payload_store=payload_store)
|
|
59
63
|
|
|
@@ -70,15 +74,17 @@ class AsyncDurableTaskSchedulerClient(AsyncTaskHubGrpcClient):
|
|
|
70
74
|
Args:
|
|
71
75
|
host_address (str): The gRPC endpoint address of the DTS service.
|
|
72
76
|
taskhub (str): The name of the task hub. Cannot be empty.
|
|
73
|
-
token_credential (
|
|
77
|
+
token_credential (TokenCredential | None): Azure credential for authentication.
|
|
74
78
|
If None, anonymous authentication will be used.
|
|
75
79
|
secure_channel (bool, optional): Whether to use a secure gRPC channel (TLS).
|
|
76
80
|
Defaults to True.
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
resiliency_options (GrpcClientResiliencyOptions | None, optional): Client-side
|
|
82
|
+
gRPC resiliency settings forwarded to the base async client.
|
|
83
|
+
default_version (str | None, optional): Default version string for orchestrations.
|
|
84
|
+
payload_store (PayloadStore | None, optional): A payload store for
|
|
79
85
|
externalizing large payloads. If None, payloads are sent inline.
|
|
80
|
-
log_handler (
|
|
81
|
-
log_formatter (
|
|
86
|
+
log_handler (logging.Handler | None, optional): Custom logging handler for client logs.
|
|
87
|
+
log_formatter (logging.Formatter | None, optional): Custom log formatter for client logs.
|
|
82
88
|
|
|
83
89
|
Raises:
|
|
84
90
|
ValueError: If taskhub is empty or None.
|
|
@@ -99,15 +105,16 @@ class AsyncDurableTaskSchedulerClient(AsyncTaskHubGrpcClient):
|
|
|
99
105
|
def __init__(self, *,
|
|
100
106
|
host_address: str,
|
|
101
107
|
taskhub: str,
|
|
102
|
-
token_credential:
|
|
103
|
-
channel:
|
|
108
|
+
token_credential: AsyncTokenCredential | None,
|
|
109
|
+
channel: grpc.aio.Channel | None = None,
|
|
104
110
|
secure_channel: bool = True,
|
|
105
|
-
interceptors:
|
|
106
|
-
channel_options:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
interceptors: Sequence[shared.AsyncClientInterceptor] | None = None,
|
|
112
|
+
channel_options: GrpcChannelOptions | None = None,
|
|
113
|
+
resiliency_options: GrpcClientResiliencyOptions | None = None,
|
|
114
|
+
default_version: str | None = None,
|
|
115
|
+
payload_store: PayloadStore | None = None,
|
|
116
|
+
log_handler: logging.Handler | None = None,
|
|
117
|
+
log_formatter: logging.Formatter | None = None):
|
|
111
118
|
|
|
112
119
|
if not taskhub:
|
|
113
120
|
raise ValueError("Taskhub value cannot be empty. Please provide a value for your taskhub")
|
|
@@ -128,5 +135,6 @@ class AsyncDurableTaskSchedulerClient(AsyncTaskHubGrpcClient):
|
|
|
128
135
|
log_formatter=log_formatter,
|
|
129
136
|
interceptors=resolved_interceptors,
|
|
130
137
|
channel_options=channel_options,
|
|
138
|
+
resiliency_options=resiliency_options,
|
|
131
139
|
default_version=default_version,
|
|
132
140
|
payload_store=payload_store)
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# Licensed under the MIT License.
|
|
3
3
|
from datetime import datetime, timedelta, timezone
|
|
4
4
|
from threading import Lock
|
|
5
|
-
from typing import Optional
|
|
6
5
|
|
|
7
6
|
from azure.core.credentials import AccessToken, TokenCredential
|
|
8
7
|
from azure.core.credentials_async import AsyncTokenCredential
|
|
@@ -13,9 +12,9 @@ import durabletask.internal.shared as shared
|
|
|
13
12
|
# By default, when there's 10minutes left before the token expires, refresh the token
|
|
14
13
|
class AccessTokenManager:
|
|
15
14
|
|
|
16
|
-
_token:
|
|
15
|
+
_token: AccessToken | None
|
|
17
16
|
|
|
18
|
-
def __init__(self, token_credential:
|
|
17
|
+
def __init__(self, token_credential: TokenCredential | None, refresh_interval_seconds: int = 600):
|
|
19
18
|
self._scope = "https://durabletask.io/.default"
|
|
20
19
|
self._refresh_interval_seconds = refresh_interval_seconds
|
|
21
20
|
self._logger = shared.get_logger("token_manager")
|
|
@@ -30,7 +29,7 @@ class AccessTokenManager:
|
|
|
30
29
|
self._token = None
|
|
31
30
|
self.expiry_time = None
|
|
32
31
|
|
|
33
|
-
def get_access_token(self) ->
|
|
32
|
+
def get_access_token(self) -> AccessToken | None:
|
|
34
33
|
if self._token is None or self.is_token_expired():
|
|
35
34
|
with self._refresh_lock:
|
|
36
35
|
if self._token is None or self.is_token_expired():
|
|
@@ -59,9 +58,9 @@ class AsyncAccessTokenManager:
|
|
|
59
58
|
|
|
60
59
|
This avoids blocking the event loop when acquiring or refreshing tokens."""
|
|
61
60
|
|
|
62
|
-
_token:
|
|
61
|
+
_token: AccessToken | None
|
|
63
62
|
|
|
64
|
-
def __init__(self, token_credential:
|
|
63
|
+
def __init__(self, token_credential: AsyncTokenCredential | None,
|
|
65
64
|
refresh_interval_seconds: int = 600):
|
|
66
65
|
self._scope = "https://durabletask.io/.default"
|
|
67
66
|
self._refresh_interval_seconds = refresh_interval_seconds
|
|
@@ -71,7 +70,7 @@ class AsyncAccessTokenManager:
|
|
|
71
70
|
self._token = None
|
|
72
71
|
self.expiry_time = None
|
|
73
72
|
|
|
74
|
-
async def get_access_token(self) ->
|
|
73
|
+
async def get_access_token(self) -> AccessToken | None:
|
|
75
74
|
if self._token is None or self.is_token_expired():
|
|
76
75
|
await self.refresh_token()
|
|
77
76
|
return self._token
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
from importlib.metadata import version
|
|
5
|
-
from typing import Optional
|
|
6
5
|
|
|
7
6
|
import grpc
|
|
8
7
|
from azure.core.credentials import TokenCredential
|
|
@@ -15,8 +14,6 @@ from durabletask.azuremanaged.internal.access_token_manager import (
|
|
|
15
14
|
from durabletask.internal.grpc_interceptor import (
|
|
16
15
|
DefaultAsyncClientInterceptorImpl,
|
|
17
16
|
DefaultClientInterceptorImpl,
|
|
18
|
-
_AsyncClientCallDetails,
|
|
19
|
-
_ClientCallDetails,
|
|
20
17
|
)
|
|
21
18
|
|
|
22
19
|
|
|
@@ -27,9 +24,9 @@ class DTSDefaultClientInterceptorImpl (DefaultClientInterceptorImpl):
|
|
|
27
24
|
|
|
28
25
|
def __init__(
|
|
29
26
|
self,
|
|
30
|
-
token_credential:
|
|
27
|
+
token_credential: TokenCredential | None,
|
|
31
28
|
taskhub_name: str,
|
|
32
|
-
worker_id:
|
|
29
|
+
worker_id: str | None = None):
|
|
33
30
|
try:
|
|
34
31
|
# Get the version of the azuremanaged package
|
|
35
32
|
sdk_version = version('durabletask-azuremanaged')
|
|
@@ -63,7 +60,7 @@ class DTSDefaultClientInterceptorImpl (DefaultClientInterceptorImpl):
|
|
|
63
60
|
self._metadata.append(("authorization", f"Bearer {token}"))
|
|
64
61
|
|
|
65
62
|
def _intercept_call(
|
|
66
|
-
self, client_call_details:
|
|
63
|
+
self, client_call_details: grpc.ClientCallDetails) -> grpc.ClientCallDetails:
|
|
67
64
|
"""Internal intercept_call implementation which adds metadata to grpc metadata in the RPC
|
|
68
65
|
call details."""
|
|
69
66
|
# Refresh the auth token if a credential was provided. The call to
|
|
@@ -83,7 +80,7 @@ class DTSAsyncDefaultClientInterceptorImpl(DefaultAsyncClientInterceptorImpl):
|
|
|
83
80
|
This class implements async gRPC interceptors to add DTS-specific headers
|
|
84
81
|
(task hub name, user agent, and authentication token) to all async calls."""
|
|
85
82
|
|
|
86
|
-
def __init__(self, token_credential:
|
|
83
|
+
def __init__(self, token_credential: AsyncTokenCredential | None, taskhub_name: str):
|
|
87
84
|
try:
|
|
88
85
|
# Get the version of the azuremanaged package
|
|
89
86
|
sdk_version = version('durabletask-azuremanaged')
|
|
@@ -115,7 +112,7 @@ class DTSAsyncDefaultClientInterceptorImpl(DefaultAsyncClientInterceptorImpl):
|
|
|
115
112
|
self._metadata.append(("authorization", f"Bearer {token}"))
|
|
116
113
|
|
|
117
114
|
async def _intercept_call(
|
|
118
|
-
self, client_call_details:
|
|
115
|
+
self, client_call_details: grpc.aio.ClientCallDetails) -> grpc.aio.ClientCallDetails:
|
|
119
116
|
"""Internal intercept_call implementation which adds metadata to grpc metadata in the RPC
|
|
120
117
|
call details."""
|
|
121
118
|
# Refresh the auth token if a credential was provided. The call to
|
|
@@ -5,15 +5,17 @@ import logging
|
|
|
5
5
|
import os
|
|
6
6
|
import socket
|
|
7
7
|
import uuid
|
|
8
|
-
|
|
9
|
-
from typing import Optional, Sequence
|
|
8
|
+
from collections.abc import Sequence
|
|
10
9
|
|
|
11
10
|
import grpc
|
|
12
11
|
from azure.core.credentials import TokenCredential
|
|
13
12
|
|
|
14
13
|
from durabletask.azuremanaged.internal.durabletask_grpc_interceptor import \
|
|
15
14
|
DTSDefaultClientInterceptorImpl
|
|
16
|
-
from durabletask.grpc_options import
|
|
15
|
+
from durabletask.grpc_options import (
|
|
16
|
+
GrpcChannelOptions,
|
|
17
|
+
GrpcWorkerResiliencyOptions,
|
|
18
|
+
)
|
|
17
19
|
import durabletask.internal.shared as shared
|
|
18
20
|
from durabletask.payload.store import PayloadStore
|
|
19
21
|
from durabletask.worker import ConcurrencyOptions, TaskHubGrpcWorker
|
|
@@ -30,17 +32,19 @@ class DurableTaskSchedulerWorker(TaskHubGrpcWorker):
|
|
|
30
32
|
Args:
|
|
31
33
|
host_address (str): The gRPC endpoint address of the DTS service.
|
|
32
34
|
taskhub (str): The name of the task hub. Cannot be empty.
|
|
33
|
-
token_credential (
|
|
35
|
+
token_credential (TokenCredential | None): Azure credential for authentication.
|
|
34
36
|
If None, anonymous authentication will be used.
|
|
35
37
|
secure_channel (bool, optional): Whether to use a secure gRPC channel (TLS).
|
|
36
38
|
Defaults to True.
|
|
37
|
-
|
|
39
|
+
resiliency_options (GrpcWorkerResiliencyOptions | None, optional): Worker-side
|
|
40
|
+
gRPC resiliency settings forwarded to the base worker.
|
|
41
|
+
concurrency_options (ConcurrencyOptions | None, optional): Configuration
|
|
38
42
|
for controlling worker concurrency limits. If None, default concurrency
|
|
39
43
|
settings will be used.
|
|
40
|
-
payload_store (
|
|
44
|
+
payload_store (PayloadStore | None, optional): A payload store for
|
|
41
45
|
externalizing large payloads. If None, payloads are sent inline.
|
|
42
|
-
log_handler (
|
|
43
|
-
log_formatter (
|
|
46
|
+
log_handler (logging.Handler | None, optional): Custom logging handler for worker logs.
|
|
47
|
+
log_formatter (logging.Formatter | None, optional): Custom log formatter for worker logs.
|
|
44
48
|
|
|
45
49
|
Raises:
|
|
46
50
|
ValueError: If taskhub is empty or None.
|
|
@@ -69,15 +73,16 @@ class DurableTaskSchedulerWorker(TaskHubGrpcWorker):
|
|
|
69
73
|
def __init__(self, *,
|
|
70
74
|
host_address: str,
|
|
71
75
|
taskhub: str,
|
|
72
|
-
token_credential:
|
|
73
|
-
channel:
|
|
76
|
+
token_credential: TokenCredential | None,
|
|
77
|
+
channel: grpc.Channel | None = None,
|
|
74
78
|
secure_channel: bool = True,
|
|
75
|
-
interceptors:
|
|
76
|
-
channel_options:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
interceptors: Sequence[shared.ClientInterceptor] | None = None,
|
|
80
|
+
channel_options: GrpcChannelOptions | None = None,
|
|
81
|
+
resiliency_options: GrpcWorkerResiliencyOptions | None = None,
|
|
82
|
+
concurrency_options: ConcurrencyOptions | None = None,
|
|
83
|
+
payload_store: PayloadStore | None = None,
|
|
84
|
+
log_handler: logging.Handler | None = None,
|
|
85
|
+
log_formatter: logging.Formatter | None = None):
|
|
81
86
|
|
|
82
87
|
if not taskhub:
|
|
83
88
|
raise ValueError("The taskhub value cannot be empty.")
|
|
@@ -101,6 +106,7 @@ class DurableTaskSchedulerWorker(TaskHubGrpcWorker):
|
|
|
101
106
|
log_formatter=log_formatter,
|
|
102
107
|
interceptors=resolved_interceptors,
|
|
103
108
|
channel_options=channel_options,
|
|
109
|
+
resiliency_options=resiliency_options,
|
|
104
110
|
concurrency_options=concurrency_options,
|
|
105
111
|
# DTS natively supports long timers so chunking is unnecessary
|
|
106
112
|
maximum_timer_interval=None,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: durabletask.azuremanaged
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Durable Task Python SDK provider implementation for the Azure Durable Task Scheduler
|
|
5
5
|
Project-URL: repository, https://github.com/microsoft/durabletask-python
|
|
6
6
|
Project-URL: changelog, https://github.com/microsoft/durabletask-python/blob/main/CHANGELOG.md
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: durabletask>=1.
|
|
13
|
+
Requires-Dist: durabletask>=1.5.0
|
|
14
14
|
Requires-Dist: azure-identity>=1.19.0
|
|
15
15
|
Provides-Extra: azure-blob-payloads
|
|
16
|
-
Requires-Dist: durabletask[azure-blob-payloads]>=1.
|
|
16
|
+
Requires-Dist: durabletask[azure-blob-payloads]>=1.5.0; extra == "azure-blob-payloads"
|
|
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "durabletask.azuremanaged"
|
|
12
|
-
version = "1.
|
|
12
|
+
version = "1.5.0"
|
|
13
13
|
description = "Durable Task Python SDK provider implementation for the Azure Durable Task Scheduler"
|
|
14
14
|
keywords = [
|
|
15
15
|
"durable",
|
|
@@ -26,13 +26,13 @@ requires-python = ">=3.10"
|
|
|
26
26
|
license = {file = "LICENSE"}
|
|
27
27
|
readme = "README.md"
|
|
28
28
|
dependencies = [
|
|
29
|
-
"durabletask>=1.
|
|
29
|
+
"durabletask>=1.5.0",
|
|
30
30
|
"azure-identity>=1.19.0"
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
[project.optional-dependencies]
|
|
34
34
|
azure-blob-payloads = [
|
|
35
|
-
"durabletask[azure-blob-payloads]>=1.
|
|
35
|
+
"durabletask[azure-blob-payloads]>=1.5.0"
|
|
36
36
|
]
|
|
37
37
|
|
|
38
38
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|