Ondemand sandbox#736
Open
YunchuWang wants to merge 82 commits into
Open
Conversation
ServerlessActivitiesClientAdapter now takes an attachTaskHubMetadata flag (default true). The Azure-managed channel already injects the taskhub header via CallCredentials, so the AddDurableTaskScheduler* path constructs the adapter with attachTaskHubMetadata: false to avoid sending duplicate headers on DeclareServerlessActivities and ConnectServerlessActivityWorker. Added two unit tests with a recording CallInvoker covering both modes.
This reverts commit 18c8e02.
- Updated README.md to clarify remote worker image settings. - Simplified task hub retrieval in Program.cs. - Removed unnecessary endpoint configuration in remote worker. - Added Azure.Identity package reference in csproj. - Refined serverless worker extensions for environment configuration. - Updated serverless activity configuration to handle registered activities. - Modified tests to reflect changes in activity registration and filtering.
Replace legacy DTS_SUBSTRATE and DTS_ON_DEMAND_SANDBOX_MAX_ACTIVITIES env vars with DTS_SANDBOX_PROVIDER and DTS_SANDBOX_MAX_ACTIVITIES. Updated worker code (environment parsing and validation), message builder, README, and tests to use the new names and updated validation/error messages. Keeps behavior the same while standardizing sandbox-related environment variable names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The scenario
A .NET app using Durable Task Scheduler should be able to keep its normal orchestration worker local, but run selected expensive or isolated activities in a DTS-started sandbox worker container.
The intended flow is:
UseSandboxWorker(), connects back to DTS, reports the activities it registered, and heartbeats active activity count.In the sample, the local app runs the orchestration and
LocalHello; the sandbox worker image runsRemoteHello. Both processes connect to the same task hub, but they must not receive the same work.What's missing
durabletask-dotnetdid not have a .NET SDK surface for this pattern.There was no client package for declaring sandbox worker profiles, no worker package for code running inside the sandbox, and no shared .NET transport for the sandbox activity protobuf service.
A few correctness details also fell out during validation:
UseWorkItemFilters(). Without it, DTS can dispatchRemoteHelloto the local worker, which does not implement that activity, so the orchestration can get stuck retrying the wrong worker.DTS_SANDBOX_IDmakes server-side routing and telemetry hard to reason about.The change
The SDK surface is split into two opt-in preview packages:
Microsoft.DurableTask.Client.AzureManaged.SandboxesMicrosoft.DurableTask.Worker.AzureManaged.SandboxesA good review path is:
src/Grpc/sandbox_service.protoandsrc/Shared/AzureManaged.Sandboxes/. This is the shared contract and transport for declaring sandbox activities, removing declarations, and connecting a live sandbox worker stream.src/Client/AzureManaged.Sandboxes/. This is the local declarer-app side:[SandboxWorkerProfile],SandboxWorkerProfileOptions, declaration discovery, validation, andSandboxActivitiesClient.src/Worker/AzureManaged.Sandboxes/. This is the sandbox-worker side:UseSandboxWorker(), activity-only filters, DTS-injected runtime settings, start/heartbeat messages, and active activity tracking.src/Worker/Grpc/. These add guarded activity execution notifications used by the sandbox worker heartbeat path.samples/on-demand-sandbox/last. It shows the intended end-to-end shape: local declarer app, remote worker image, and shared activity names.The new sandbox packages target
net10.0only because this is new preview functionality. NuGet publish jobs are split per package so an already-published AzureManaged package version does not block publishing the new Sandboxes packages.