mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-03-19 19:21:06 -05:00
29 lines
540 B
Python
29 lines
540 B
Python
# > Simple
|
|
from hatchet_sdk import Context, EmptyModel, Hatchet
|
|
|
|
hatchet = Hatchet(debug=True)
|
|
|
|
|
|
@hatchet.task()
|
|
def simple(input: EmptyModel, ctx: Context) -> dict[str, str]:
|
|
return {"result": "Hello, world!"}
|
|
|
|
|
|
@hatchet.durable_task()
|
|
def simple_durable(input: EmptyModel, ctx: Context) -> dict[str, str]:
|
|
return {"result": "Hello, world!"}
|
|
|
|
|
|
def main() -> None:
|
|
worker = hatchet.worker(
|
|
"test-worker",
|
|
workflows=[simple, simple_durable],
|
|
)
|
|
worker.start()
|
|
|
|
|
|
# !!
|
|
|
|
if __name__ == "__main__":
|
|
main()
|