Skip to content

Commit 587b8cc

Browse files
committed
Add sandbox activity versions to worker profiles
1 parent 660101d commit 587b8cc

16 files changed

Lines changed: 263 additions & 135 deletions

File tree

durabletask-azuremanaged/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1111
- Added preview `durabletask.azuremanaged.preview.sandboxes` APIs for
1212
declaring Durable Task Scheduler sandbox activities, registering
1313
worker profiles, and running sandbox activity workers.
14+
- Added optional activity versions to sandbox worker profile declarations and
15+
sandbox worker registration.
1416

1517
## v1.5.0
1618

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4bfa45c4fe73c95d4c33c06a6fc99e351c8f130e
1+
24df6525803b4da812bae4ecff82b589365c9691

durabletask-azuremanaged/durabletask/azuremanaged/internal/sandbox_service_pb2.py

Lines changed: 27 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

durabletask-azuremanaged/durabletask/azuremanaged/internal/sandbox_service_pb2.pyi

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ class SandboxActivityWorkerMessage(_message.Message):
2424
def __init__(self, start: _Optional[_Union[SandboxActivityWorkerStart, _Mapping]] = ..., heartbeat: _Optional[_Union[SandboxActivityWorkerHeartbeat, _Mapping]] = ...) -> None: ...
2525

2626
class SandboxActivityWorkerStart(_message.Message):
27-
__slots__ = ("task_hub", "max_activities_count", "sandbox_provider", "dts_sandbox_identifier", "worker_profile_id", "activity_names")
27+
__slots__ = ("task_hub", "max_activities_count", "sandbox_provider", "dts_sandbox_identifier", "worker_profile_id", "activities")
2828
TASK_HUB_FIELD_NUMBER: _ClassVar[int]
2929
MAX_ACTIVITIES_COUNT_FIELD_NUMBER: _ClassVar[int]
3030
SANDBOX_PROVIDER_FIELD_NUMBER: _ClassVar[int]
3131
DTS_SANDBOX_IDENTIFIER_FIELD_NUMBER: _ClassVar[int]
3232
WORKER_PROFILE_ID_FIELD_NUMBER: _ClassVar[int]
33-
ACTIVITY_NAMES_FIELD_NUMBER: _ClassVar[int]
33+
ACTIVITIES_FIELD_NUMBER: _ClassVar[int]
3434
task_hub: str
3535
max_activities_count: int
3636
sandbox_provider: SandboxProviderKind
3737
dts_sandbox_identifier: str
3838
worker_profile_id: str
39-
activity_names: _containers.RepeatedScalarFieldContainer[str]
40-
def __init__(self, task_hub: _Optional[str] = ..., max_activities_count: _Optional[int] = ..., sandbox_provider: _Optional[_Union[SandboxProviderKind, str]] = ..., dts_sandbox_identifier: _Optional[str] = ..., worker_profile_id: _Optional[str] = ..., activity_names: _Optional[_Iterable[str]] = ...) -> None: ...
39+
activities: _containers.RepeatedCompositeFieldContainer[SandboxActivity]
40+
def __init__(self, task_hub: _Optional[str] = ..., max_activities_count: _Optional[int] = ..., sandbox_provider: _Optional[_Union[SandboxProviderKind, str]] = ..., dts_sandbox_identifier: _Optional[str] = ..., worker_profile_id: _Optional[str] = ..., activities: _Optional[_Iterable[_Union[SandboxActivity, _Mapping]]] = ...) -> None: ...
4141

4242
class SandboxActivityWorkerHeartbeat(_message.Message):
4343
__slots__ = ("active_activities_count",)
@@ -51,8 +51,8 @@ class SandboxActivityWorkerSessionResult(_message.Message):
5151
message: str
5252
def __init__(self, message: _Optional[str] = ...) -> None: ...
5353

54-
class SandboxActivityDeclaration(_message.Message):
55-
__slots__ = ("worker_profile_id", "activity_names", "image", "environment_variables", "max_concurrent_activities", "resources", "scheduler_managed_identity_client_id")
54+
class SandboxWorkerProfile(_message.Message):
55+
__slots__ = ("worker_profile_id", "activities", "image", "environment_variables", "max_concurrent_activities", "resources", "scheduler_managed_identity_client_id")
5656
class EnvironmentVariablesEntry(_message.Message):
5757
__slots__ = ("key", "value")
5858
KEY_FIELD_NUMBER: _ClassVar[int]
@@ -61,20 +61,28 @@ class SandboxActivityDeclaration(_message.Message):
6161
value: str
6262
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
6363
WORKER_PROFILE_ID_FIELD_NUMBER: _ClassVar[int]
64-
ACTIVITY_NAMES_FIELD_NUMBER: _ClassVar[int]
64+
ACTIVITIES_FIELD_NUMBER: _ClassVar[int]
6565
IMAGE_FIELD_NUMBER: _ClassVar[int]
6666
ENVIRONMENT_VARIABLES_FIELD_NUMBER: _ClassVar[int]
6767
MAX_CONCURRENT_ACTIVITIES_FIELD_NUMBER: _ClassVar[int]
6868
RESOURCES_FIELD_NUMBER: _ClassVar[int]
6969
SCHEDULER_MANAGED_IDENTITY_CLIENT_ID_FIELD_NUMBER: _ClassVar[int]
7070
worker_profile_id: str
71-
activity_names: _containers.RepeatedScalarFieldContainer[str]
71+
activities: _containers.RepeatedCompositeFieldContainer[SandboxActivity]
7272
image: SandboxActivityImage
7373
environment_variables: _containers.ScalarMap[str, str]
7474
max_concurrent_activities: int
7575
resources: SandboxActivityResources
7676
scheduler_managed_identity_client_id: str
77-
def __init__(self, worker_profile_id: _Optional[str] = ..., activity_names: _Optional[_Iterable[str]] = ..., image: _Optional[_Union[SandboxActivityImage, _Mapping]] = ..., environment_variables: _Optional[_Mapping[str, str]] = ..., max_concurrent_activities: _Optional[int] = ..., resources: _Optional[_Union[SandboxActivityResources, _Mapping]] = ..., scheduler_managed_identity_client_id: _Optional[str] = ...) -> None: ...
77+
def __init__(self, worker_profile_id: _Optional[str] = ..., activities: _Optional[_Iterable[_Union[SandboxActivity, _Mapping]]] = ..., image: _Optional[_Union[SandboxActivityImage, _Mapping]] = ..., environment_variables: _Optional[_Mapping[str, str]] = ..., max_concurrent_activities: _Optional[int] = ..., resources: _Optional[_Union[SandboxActivityResources, _Mapping]] = ..., scheduler_managed_identity_client_id: _Optional[str] = ...) -> None: ...
78+
79+
class SandboxActivity(_message.Message):
80+
__slots__ = ("name", "version")
81+
NAME_FIELD_NUMBER: _ClassVar[int]
82+
VERSION_FIELD_NUMBER: _ClassVar[int]
83+
name: str
84+
version: str
85+
def __init__(self, name: _Optional[str] = ..., version: _Optional[str] = ...) -> None: ...
7886

7987
class SandboxActivityImage(_message.Message):
8088
__slots__ = ("image_ref", "managed_identity_client_id", "entrypoint", "cmd")
@@ -96,16 +104,16 @@ class SandboxActivityResources(_message.Message):
96104
memory: str
97105
def __init__(self, cpu: _Optional[str] = ..., memory: _Optional[str] = ...) -> None: ...
98106

99-
class SandboxActivityDeclarationResult(_message.Message):
107+
class DeclareSandboxWorkerProfileResult(_message.Message):
100108
__slots__ = ()
101109
def __init__(self) -> None: ...
102110

103-
class RemoveSandboxActivityDeclarationRequest(_message.Message):
111+
class RemoveSandboxWorkerProfileRequest(_message.Message):
104112
__slots__ = ("worker_profile_id",)
105113
WORKER_PROFILE_ID_FIELD_NUMBER: _ClassVar[int]
106114
worker_profile_id: str
107115
def __init__(self, worker_profile_id: _Optional[str] = ...) -> None: ...
108116

109-
class RemoveSandboxActivityDeclarationResult(_message.Message):
117+
class RemoveSandboxWorkerProfileResult(_message.Message):
110118
__slots__ = ()
111119
def __init__(self) -> None: ...

durabletask-azuremanaged/durabletask/azuremanaged/internal/sandbox_service_pb2_grpc.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
from durabletask.azuremanaged.internal import sandbox_service_pb2 as durabletask_dot_azuremanaged_dot_internal_dot_sandbox__service__pb2
77

8-
GRPC_GENERATED_VERSION = '1.80.0'
8+
GRPC_GENERATED_VERSION = '1.65.4'
99
GRPC_VERSION = grpc.__version__
10+
EXPECTED_ERROR_RELEASE = '1.66.0'
11+
SCHEDULED_RELEASE_DATE = 'August 6, 2024'
1012
_version_not_supported = False
1113

1214
try:
@@ -16,12 +18,15 @@
1618
_version_not_supported = True
1719

1820
if _version_not_supported:
19-
raise RuntimeError(
21+
warnings.warn(
2022
f'The grpc package installed is at version {GRPC_VERSION},'
21-
+ ' but the generated code in durabletask/azuremanaged/internal/sandbox_service_pb2_grpc.py depends on'
23+
+ f' but the generated code in durabletask/azuremanaged/internal/sandbox_service_pb2_grpc.py depends on'
2224
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
2325
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
2426
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
27+
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
28+
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
29+
RuntimeWarning
2530
)
2631

2732

@@ -65,8 +70,6 @@ def ConnectSandboxActivityWorker(self, request_iterator, context):
6570

6671
def DeclareSandboxWorkerProfile(self, request, context):
6772
"""Creates or updates a sandbox worker profile before any live worker stream exists.
68-
This private preview supports activity execution only as a business
69-
decision; orchestrations and entities are not part of this contract.
7073
This is a configuration contract and does not advertise active worker
7174
capacity.
7275
"""

durabletask-azuremanaged/durabletask/azuremanaged/preview/sandboxes/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
"""
1717

1818
from durabletask.azuremanaged.preview.sandboxes.client import SandboxActivitiesClient
19+
from durabletask.azuremanaged.preview.sandboxes.helpers import SandboxActivity
1920
from durabletask.azuremanaged.preview.sandboxes.worker_profiles import SandboxWorkerProfile
2021
from durabletask.azuremanaged.preview.sandboxes.worker_profiles import SandboxWorkerProfileOptions
2122
from durabletask.azuremanaged.preview.sandboxes.worker_profiles import sandbox_worker_profile
2223
from durabletask.azuremanaged.preview.sandboxes.worker import SandboxWorker
2324

2425
__all__ = [
2526
"SandboxWorker",
27+
"SandboxActivity",
2628
"SandboxWorkerProfile",
2729
"SandboxWorkerProfileOptions",
2830
"SandboxActivitiesClient",

0 commit comments

Comments
 (0)