orchestrator-core
orchestrator-core copied to clipboard
[Feature]: Add a `@task` decorator
Contact Details
No response
What should we build?
Tasks are currently defined with:
@workflow("Some task", target=Target.SYSTEM)
def some_task() -> StepList:
return init >> step1 >> step2 >> done
And a create/modify/terminate workflow is defined with:
@create_workflow("Create Node", initial_input_form=initial_input_form_generator)
def create_node() -> StepList:
return begin >> step1 >> step2
While under the hood a task is for the most part "just a workflow", we do have a separation between workflows and tasks in the UI. We could have the same separation in the backend so that we don't have to keep explaining "Target.SYSTEM means it's a task". Also, because tasks use the lower-level @workflow decorator which doesn't initialize a StepList, it has to start with init instead of begin and it must end with a done; this contrast with the other decorators is confusing.
Therefore I propose to add a @task() decorator that can be used like this:
@task("Some task")
def some_task() -> StepList:
return begin >> step1 >> step2
Relevant pseudo code