mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-01 06:11:02 -06:00
25 lines
491 B
Python
25 lines
491 B
Python
from pydantic import BaseModel
|
|
|
|
from hatchet_sdk import Context
|
|
|
|
from ..hatchet_client import hatchet
|
|
|
|
|
|
# > Simple task
|
|
class SimpleInput(BaseModel):
|
|
message: str
|
|
|
|
|
|
class SimpleOutput(BaseModel):
|
|
transformed_message: str
|
|
|
|
|
|
# Declare the task to run
|
|
@hatchet.task(name="first-task", input_validator=SimpleInput)
|
|
def first_task(input: SimpleInput, ctx: Context) -> SimpleOutput:
|
|
print("first-task task called")
|
|
|
|
return SimpleOutput(transformed_message=input.message.lower())
|
|
|
|
|