Files
hatchet/python-sdk/examples/manual_trigger/worker.py
Gabe Ruttner 45813fdb1b feat: dashboard playground ui (#162)
* hotfix: add repository for npm publish

* release(py-sdk): bump version

* chore: ignore venv

* feat(dashboard): collapsible sidebar

* fix: hangup workflow listener when workflow run finishes (#161)

* wip: class based listener pattern

* fix: workflow run listener hangups

* fix: hang up workflow listener on finished

* fix: case for current workflow run

* address review comments

* bump version

---------

Co-authored-by: g <gabriel.ruttner@gmail.com>

* wip: focus state and flat playground

* fix: focus state

* feat: unify state

* wip: playground state

* cleanup: rm logging

* fix: default output

* cleanup: rm deadcode

* feat: can replay individual steps

* feat: icon tabs

* feat: sticky output

* cleanup: linting

---------

Co-authored-by: abelanger5 <belanger@sas.upenn.edu>
2024-02-13 10:24:46 -07:00

29 lines
648 B
Python

from hatchet_sdk import Hatchet
from dotenv import load_dotenv
load_dotenv()
hatchet = Hatchet(debug=True)
@hatchet.workflow(on_events=["man:create"])
class ManualTriggerWorkflow:
@hatchet.step()
def step1(self, context):
print("executed step1")
return {"step1": "data1"}
@hatchet.step(parents=["step1"], timeout='4s')
def step2(self, context):
print("started step2")
context.sleep(1)
print("finished step2")
return {"step2": "data2"}
workflow = ManualTriggerWorkflow()
worker = hatchet.worker('manual-worker', max_threads=4)
worker.register_workflow(workflow)
worker.start()