from tilebox.workflows import Task, ExecutionContext
class MyFirstTask(Task):
def execute(self, context: ExecutionContext):
print(f"Hello World!")
@staticmethod
def identifier() -> tuple[str, str]:
return ("tilebox.workflows.MyTask", "v3.2")
class MyFirstParameterizedTask(Task):
name: str
greet: bool
data: dict[str, str]
def execute(self, context: ExecutionContext):
if self.greet:
print(f"Hello {self.name}!")
Base class for Tilebox workflows tasks. Inherit from this class to create a task.
Inheriting also automatically applies the dataclass decorator.
Methods
The entry point for the execution of the task.
Override a task identifier and specify its version. If not overridden, the identifier of a task defaults to the class name, and the version to v0.0
.
Optional task input parameters, defined as class attributes. Supported types
are str
, int
, float
, bool
, as well as lists
and dicts
thereof.
from tilebox.workflows import Task, ExecutionContext
class MyFirstTask(Task):
def execute(self, context: ExecutionContext):
print(f"Hello World!")
@staticmethod
def identifier() -> tuple[str, str]:
return ("tilebox.workflows.MyTask", "v3.2")
class MyFirstParameterizedTask(Task):
name: str
greet: bool
data: dict[str, str]
def execute(self, context: ExecutionContext):
if self.greet:
print(f"Hello {self.name}!")