-
Notifications
You must be signed in to change notification settings - Fork 632
Initial integration of Durable Task Scheduler (i.e. emulator) #9294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Looks like I need to get a couple packages into the Azure DevOps feeds:
|
return WebUtility.UrlEncode(value); | ||
} | ||
|
||
string IManifestExpressionProvider.ValueExpression => WebUtility.UrlEncode(_reference.ValueExpression); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is #3117
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know! Will be happy to drop this implementation when there's a common solution.
|
||
var app = builder.Build(); | ||
|
||
app.MapPost("/create", async ([FromBody] EchoValue value, [FromServices] DurableTaskClient durableTaskClient) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It magically knows!
app.MapPost("/create", async ([FromBody] EchoValue value, [FromServices] DurableTaskClient durableTaskClient) => | |
app.MapPost("/create", async (EchoValue value, DurableTaskClient durableTaskClient) => |
clientBuilder.UseDurableTaskScheduler( | ||
builder.Configuration.GetConnectionString("taskhub") ?? throw new InvalidOperationException("Scheduler connection string not configured."), | ||
options => | ||
{ | ||
options.AllowInsecureCredentials = true; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we build a client integration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...yes? It's complicated because consuming applications can be either DTS "clients" or "workers" (and sometimes both), and there are separate SDKs for each which means multiple client integrations. Also, there are two sets of SDKs that apps can use (and you might consider another scenario a third) which further expands the matrix.
I'd say we should start with client integrations for the "modern" SDK, worker first and then client, as the former is the most common. Then, if there's demand, look at integrations for the "older" SDKs. That said, any client integrations would be follow up PRs.
|
||
var scheduler = | ||
builder.AddDurableTaskScheduler("scheduler") | ||
.RunAsExisting(builder.AddParameter("scheduler-connection-string")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in the sample?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent was to have examples that demonstrate the two main DTS scenarios: use of the DTS emulator and use of an existing DTS instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I'm having a hard time understanding is the deployment story here. Is this an azure resource as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, DTS is an Azure resource (though I'm not intending to support deployment in this initial pass). I did a little experimenting with the Bicep base resource type that other Azure resources are built upon, but they rely on Azure provisioning libraries that do not exist, yet, for DTS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this model is going to be:
AddAzureDurableTaskScheudler().RunAsEmulator()
yes?
|
||
namespace Aspire.Hosting.Azure; | ||
|
||
interface IResourceWithDashboard : IResource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit:
interface IResourceWithDashboard : IResource | |
internal interface IResourceWithDashboard : IResource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do we need this? This naming is very generic and only used by one resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used by both DTS resources, where each implements in a slightly different manner. I've updated the name to be DTS specific.
builder | ||
.WithEndpoint(name: DurableTaskConstants.Scheduler.Emulator.Endpoints.Worker, scheme: "http", targetPort: 8080) | ||
.WithEndpoint(name: DurableTaskConstants.Scheduler.Emulator.Endpoints.Dashboard, scheme: "http", targetPort: 8082) | ||
.WithAnnotation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WithEnvironment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed that overload; updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also WithHttpEndpoint. Do we also need to add health checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated that, too. I suppose health checks for the emulator could be useful, though I need to look at the API and examples. I'd be inclined to leave that as a separate, follow up PR.
src/Aspire.Hosting.Azure.Functions/DurableTask/DurableTaskSchedulerResource.cs
Outdated
Show resolved
Hide resolved
Signed-off-by: Phillip Hoff <phillip@orst.edu>
.RunAsEmulator( | ||
options => | ||
{ | ||
options.WithDynamicTaskHubs(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this explicit call needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a demonstration of configuring options on the emulator. (Not every Aspire application will want to use dynamic task hub names.)
Signed-off-by: Phillip Hoff <phillip@orst.edu>
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #8926
Checklist
<remarks />
and<code />
elements on your triple slash comments?