laboneq.workflow.task(func=None, *, name=None, save=True, hidden=False)
ΒΆ
task(func: Callable[T, B], *, name: str | None = ..., save: bool = ..., hidden: bool = ...) -> task_[T, B]
task(func: None = ..., *, name: str | None = ..., save: bool = ..., hidden: bool = ...) -> Callable[[Callable[T, B]], task_[T, B]]
Mark a function as a workflow task.
If the decorated function is used outside of an workflow related context, or within another task, the underlying behavior does not change.
The function signature must not have positional-only arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
Callable[T, B] | None
|
Function to be wrapped as a task. |
None
|
name
|
str | None
|
Name of the task. Defaults to function name. |
None
|
save
|
bool
|
A flag to indicate whether the task inputs and outputs should be saved by logbooks. The flag has no effect on saving done inside the task. |
True
|
hidden
|
bool
|
Mark the task as hidden task.
When set, the task won't be visible to |
False
|
Example
from laboneq.workflow import task
@task
def my_task(x, y):
return x + y
my_task(1, 1)