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:
abelanger5
2024-01-20 06:18:25 -08:00
committed by GitHub
parent 52fde1e704
commit 0c94f0d933
52 changed files with 2800 additions and 65 deletions

View File

@@ -0,0 +1,10 @@
from hatchet import new_client
client = new_client()
client.event.push(
"user:create",
{
"test": "test"
}
)

View File

@@ -0,0 +1,42 @@
from hatchet import Hatchet, Context
hatchet = Hatchet()
@hatchet.workflow(on_events=["user:create"])
class MyWorkflow:
def __init__(self):
self.my_value = "test"
@hatchet.step()
def step1(self, context : Context):
print("executed step1", context.workflow_input())
return {
"step1": "step1",
}
@hatchet.step()
def step2(self, context : Context):
print("executed step2", context.workflow_input())
return {
"step2": "step2",
}
@hatchet.step(parents=["step1", "step2"])
def step3(self, context : Context):
print("executed step3", context.workflow_input(), context.step_output("step1"), context.step_output("step2"))
return {
"step3": "step3",
}
@hatchet.step(parents=["step1", "step3"])
def step4(self, context : Context):
print("executed step4", context.workflow_input(), context.step_output("step1"), context.step_output("step3"))
return {
"step4": "step4",
}
workflow = MyWorkflow()
worker = hatchet.worker('test-worker')
worker.register_workflow(workflow)
worker.start()