mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-02-10 10:08:46 -06:00
* fix: python sdk graceful shutdown and retry errors * chore: address changes from review
27 lines
551 B
Python
27 lines
551 B
Python
from hatchet_sdk import Hatchet
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
hatchet = Hatchet(debug=True)
|
|
|
|
@hatchet.workflow(on_events=["user:create"])
|
|
class MyWorkflow:
|
|
def __init__(self):
|
|
self.my_value = "test"
|
|
|
|
@hatchet.step()
|
|
def step1(self, context):
|
|
print("executed step1")
|
|
pass
|
|
|
|
@hatchet.step(parents=["step1"])
|
|
def step2(self, context):
|
|
print("executed step2")
|
|
pass
|
|
|
|
workflow = MyWorkflow()
|
|
worker = hatchet.worker('test-worker')
|
|
worker.register_workflow(workflow)
|
|
|
|
worker.start() |