Skip to content
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

Workflow Authoring: initial methods #981

Merged
merged 21 commits into from
Jan 13, 2023
Merged

Conversation

tmacam
Copy link
Contributor

@tmacam tmacam commented Nov 18, 2022

Description

(This PR is a re-submission of PR #973 with extra fixes when appropriate)

This is a work in progress PR for dapr workflow initial methods for dotnet-sdk.
This needs e2e tests still.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #979

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

amulyavarote and others added 11 commits November 7, 2022 13:57
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
This commit re-adds commit dapr@d5b9189 but with DCO.

Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
@tmacam tmacam requested review from a team as code owners November 18, 2022 00:53
@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Merging #981 (fb8589c) into master (ab5403e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #981   +/-   ##
=======================================
  Coverage   69.90%   69.90%           
=======================================
  Files         157      157           
  Lines        5224     5224           
  Branches      562      562           
=======================================
  Hits         3652     3652           
  Misses       1439     1439           
  Partials      133      133           
Flag Coverage Δ
net5 69.85% <ø> (ø)
net6 69.81% <ø> (-0.02%) ⬇️
netcoreapp3.1 69.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tmacam tmacam changed the title [WIP] Dapr Workflow initial methods for dotnet-sdk Dapr Workflow initial methods for dotnet-sdk Nov 18, 2022
@cgillum
Copy link
Contributor

cgillum commented Dec 9, 2022

Hi @tmacam, can you please accept my PR here, which will update the Microsoft.DurableTask.* dependencies in this PR to v1.0.0-rc.1? There were several breaking changes and important bug fixes in that release, and we should make sure that those changes are reflected in this new Dapr Workflow SDK.

cgillum and others added 2 commits December 8, 2022 18:01
Signed-off-by: Chris Gillum <cgillum@microsoft.com>
/// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
/// <param name="configure">A delegate used to configure actor options and register workflow functions.</param>
public static IServiceCollection AddWorkflow(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AddDaprWorkflow()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could go either way, but the Actors SDK names the equivalent extension method AddActors() (no "Dapr") so AddDaprWorkflow would be a bit inconsistent with the actor SDK.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion, but .NET has (had) a number of "workflow" related frameworks, so it could be helpful to have "Dapr" in the method name. Actors isn't as common, so there's less potential for confusion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine either way. I'm not super familiar with the existing options though, so my concern would be if this would clobber anything. Do we expect people to have our libraries and the other workflow libraries together?

Copy link
Collaborator

@philliphoff philliphoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nits and comments re: naming, overall looks good though.

* Rename ActivityContext to WorkflowActivityContext
* Change example webapp port away from 8080x

Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
Copy link
Contributor

@halspang halspang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments, honestly. Most comments stem from wanting to understand the workflow experience a bit more.

Comment on lines 9 to 19
// Example of registering a "Hello World" workflow function
options.RegisterWorkflow<string, string>("HelloWorld", implementation: async (context, input) =>
{
return await context.CallActivityAsync<string>("SayHello", "World");
});

// Example of registering a "Say Hello" workflow activity function
options.RegisterActivity<string, string>("SayHello", implementation: (context, input) =>
{
return Task.FromResult($"Hello, {input}!");
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do workflows and activities relate to each other? Should they be tied together in the API at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will let other correct me but if you think of a workflow as defining a graph, activities are the nodes. Both concepts are linked. https://docs.temporal.io/activities

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't say this is required, just musing since this is a preview/alpha feature:

That was my initial thought, but I guess my question was more do the activities need to be directly related to the workflow, or can they exist outside of one? Should we have some kind of validation that checks that "SayHello" is defiend? Or should we define the activity in the workflow registration/via actual object references?

examples/Workflow/WorkflowWebApp/Program.cs Show resolved Hide resolved
examples/Workflow/WorkflowWebApp/Program.cs Outdated Show resolved Hide resolved
examples/Workflow/WorkflowWebApp/Program.cs Outdated Show resolved Hide resolved
src/Dapr.Workflow/WorkflowContext.cs Show resolved Hide resolved
src/Dapr.Workflow/WorkflowMetadata.cs Show resolved Hide resolved
src/Dapr.Workflow/WorkflowRuntimeOptions.cs Outdated Show resolved Hide resolved
/// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
/// <param name="configure">A delegate used to configure actor options and register workflow functions.</param>
public static IServiceCollection AddWorkflow(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine either way. I'm not super familiar with the existing options though, so my concern would be if this would clobber anything. Do we expect people to have our libraries and the other workflow libraries together?

src/Dapr.Workflow/WorkflowServiceCollectionExtensions.cs Outdated Show resolved Hide resolved
* Rename workflow and activity in example to be more meangniful
* Add parameter documentation to some methods
* Use local project references when appropriate

Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
…atch what it does

Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
…ntAsync

Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
cgillum
cgillum previously approved these changes Jan 12, 2023
Copy link
Contributor

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this PR as it is. There are a several additions I'd like to make, but those can be done in subsequent PRs.

src/Dapr.Workflow/WorkflowRuntimeOptions.cs Outdated Show resolved Hide resolved
@tmacam tmacam changed the title Dapr Workflow initial methods for dotnet-sdk Workflow Authoring: initial methods Jan 12, 2023
Copy link
Contributor

@halspang halspang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the code seems fine. I think the big thing for me is that we should remove the example entirely to start off. Examples should show how we want users to invoke/use the code instead of just providing the syntax.

What I'd prefer to do here is create an issue to create a workflow and once the code is complete, spend some time to make a more real-world example that shows workflows as part of a larger picture.

Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
@tmacam
Copy link
Contributor Author

tmacam commented Jan 12, 2023

Overall, the code seems fine. I think the big thing for me is that we should remove the example entirely to start off. Examples should show how we want users to invoke/use the code instead of just providing the syntax.

What I'd prefer to do here is create an issue to create a workflow and once the code is complete, spend some time to make a more real-world example that shows workflows as part of a larger picture.

@cgillum, you will be updating the example in a follow up PR, yes? So I will defer comment regarding the removal of the example to you.

@cgillum
Copy link
Contributor

cgillum commented Jan 12, 2023

Yes, I can update the example to be closer to the recent demo I gave. I agree that would be much better. However, I don't necessarily agree that we should exclude the existing example from this PR. That's just creating unnecessary work for us, and I think it's honestly better than having nothing at all.

Signed-off-by: Tiago Alves Macambira <tmacam@burocrata.org>
@halspang
Copy link
Contributor

Yes, I can update the example to be closer to the recent demo I gave. I agree that would be much better. However, I don't necessarily agree that we should exclude the existing example from this PR. That's just creating unnecessary work for us, and I think it's honestly better than having nothing at all.

If it we're planning on updating it shortly, that works for me. I just wanted to make sure we had a full example before we eventually hit a full release for workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add initial Dapr workflow authoring APIs
6 participants