mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-02-10 18:19:08 -06:00
feat: python client (#109)
* (wip) python SDK * feat: python client, initial version finished * fix: add curl to migration dockerfile * add insecure option for grpc * create docs and publishing workflow * delete old hatchet folder
This commit is contained in:
10
python-client/examples/simple/event_test.py
Normal file
10
python-client/examples/simple/event_test.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from hatchet import new_client
|
||||
|
||||
client = new_client()
|
||||
|
||||
client.event.push(
|
||||
"user:create",
|
||||
{
|
||||
"test": "test"
|
||||
}
|
||||
)
|
||||
24
python-client/examples/simple/worker.py
Normal file
24
python-client/examples/simple/worker.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from hatchet import Hatchet
|
||||
|
||||
hatchet = Hatchet()
|
||||
|
||||
@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()
|
||||
Reference in New Issue
Block a user