mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-04-23 02:34:48 -05:00
chore(python-sdk): improved thread cancellation handling, docs, and custom sleep method (#134)
* feat: timeout on python steps * chore(python-sdk): improved thread handling and docs * docs: default timeout
This commit is contained in:
@@ -15,13 +15,14 @@ class MyWorkflow:
|
||||
print("executed step1")
|
||||
pass
|
||||
|
||||
@hatchet.step(parents=["step1"])
|
||||
@hatchet.step(parents=["step1"],timeout='4s')
|
||||
def step2(self, context):
|
||||
print("executed step2")
|
||||
pass
|
||||
print("started step2")
|
||||
context.sleep(1)
|
||||
print("finished step2")
|
||||
|
||||
workflow = MyWorkflow()
|
||||
worker = hatchet.worker('test-worker')
|
||||
worker = hatchet.worker('test-worker', max_threads=4)
|
||||
worker.register_workflow(workflow)
|
||||
|
||||
worker.start()
|
||||
Reference in New Issue
Block a user