-
Notifications
You must be signed in to change notification settings - Fork 51
Add support for registering custom tasks #245
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
bebd510 to
27de322
Compare
|
@hughneale thanks! Can you take a look at the CI error? The code looks ok, can you add a link to the spec to this PR, or open an issue with a link to it? So we have it documented and traced back to the spec. Thanks!! |
Signed-off-by: hughneale <mail@hughneale.com>
Signed-off-by: hughneale <mail@hughneale.com>
7c175ef to
07f3bbf
Compare
|
@ricardozanini good to merge? Thanks for the review. |
|
@hughneale I'm curious about where in the spec we have custom tasks specified. I haven't found this info there. |
|
@ricardozanini - The spec says:
For me reading this. It says that tasks are modular and the list below are the tasks that at a minimum need to be implemented. It doesn't say that these are the only tasks that can be supported. So as it's designed to be modular I'd reasoned that support for registering custom tasks was acceptable. |
|
@hughneale While your interpretation makes a lot of sense, I believe it’s essential to emphasize the portable nature of workflows defined in Serverless Workflow. Consequently, custom implementations should generally be avoided in favor of extensions and custom functions, which are constructed using the fundamental building blocks defined by the specification — and are therefore fully portable across runtimes. See https://github.com/serverlessworkflow/specification/blob/main/dsl.md#extensions |
|
Exactly, "custom" tasks are extensions that are pre-defined |
|
Thanks guys. The problem I am running into is I want to be able to provide simplified components (which maybe a collection of tasks) for people to use. For example I want to provide a task that:
This could of course be a sub workflow. However, there's a lot of work to do to put this together and I would rather provide a custom task like: do:
starwars: getCharacterLocations
with:
name: Luke SkywalkerI don't want to inject workflow tasks or modify workflows created as this can obviously create its own issues. You could argue that I could just create a custom function to do all of this. However, I want to make each function directly callable so it can be individually retried and faulted. Rather than the entire function that may encapsulate 10 calls and then it becomes more problematic to recover from and revert state if needed. My real world example is here: https://github.com/thand-io/agent/blob/main/internal/workflows/tasks/providers/thand/approvals.go#L61 that mixes listening, switches, export etc that I just don’t want a user building a workflow to have to deal with. I hope that helps. |
What this PR does / why we need it:
As per the serverlesss workflow spec aside from the default tasks. Users should be able to register their own tasks for their own serverless workflow implementations
Special notes for reviewers:
Additional information (if needed):