Files
hatchet/sdks/python/examples/simple/worker.py
matt 0cce1cfc04 Revert: Cancellation token Python changes (#3061)
* revert: cancellation token changes

* fix: changelog

* fix: add note on yank
2026-02-19 12:41:43 -05:00

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()