Files
hatchet/python-sdk/examples/manual_trigger/trigger.py
Gabe Ruttner 5ccc5614a9 feat(py-sdk): event streaming and manual triggering (#152)
* hotfix: add repository for npm publish

* chore: generate protos

* feat: trigger workflow

* fix: remove tenant id from schedule workflow

* fix: logging

* feat: run returns workflow_run_id

* feat: listen for run events

* feat: listener calls handler

* chore: address review comment
2024-02-05 12:32:04 -05:00

17 lines
394 B
Python

from hatchet_sdk import new_client
from dotenv import load_dotenv
import json
load_dotenv()
client = new_client()
workflowRunId = client.admin.run_workflow("ManualTriggerWorkflow", {
"test": "test"
})
client.listener.on(workflowRunId, lambda event: print(
'EVENT: ' + event.type + ' ' + json.dumps(event.payload)))
# TODO - need to hangup the listener if the workflow is completed