mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-02-17 21:59:05 -06:00
chore: regenerate examples (#2477)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
committed by
GitHub
parent
4518ff771c
commit
f12c3e96ce
3
examples/python/dataclasses/trigger.py
Normal file
3
examples/python/dataclasses/trigger.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from examples.dataclasses.worker import Input, say_hello
|
||||
|
||||
say_hello.run(input=Input(name="Hatchet"))
|
||||
31
examples/python/dataclasses/worker.py
Normal file
31
examples/python/dataclasses/worker.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Literal
|
||||
|
||||
from hatchet_sdk import Context, EmptyModel, Hatchet
|
||||
|
||||
|
||||
@dataclass
|
||||
class Input:
|
||||
name: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class Output:
|
||||
message: str
|
||||
|
||||
|
||||
hatchet = Hatchet(debug=True)
|
||||
|
||||
|
||||
@hatchet.task(input_validator=Input)
|
||||
def say_hello(input: Input, ctx: Context) -> Output:
|
||||
return Output(message=f"Hello, {input.name}!")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
worker = hatchet.worker("test-worker", workflows=[say_hello])
|
||||
worker.start()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -21,6 +21,7 @@ from examples.concurrency_workflow_level.worker import (
|
||||
)
|
||||
from examples.conditions.worker import task_condition_workflow
|
||||
from examples.dag.worker import dag_workflow
|
||||
from examples.dataclasses.worker import say_hello
|
||||
from examples.dedupe.worker import dedupe_child_wf, dedupe_parent_wf
|
||||
from examples.dependency_injection.worker import (
|
||||
async_task_with_dependencies,
|
||||
@@ -92,6 +93,7 @@ def main() -> None:
|
||||
sync_task_with_dependencies,
|
||||
durable_async_task_with_dependencies,
|
||||
durable_sync_task_with_dependencies,
|
||||
say_hello,
|
||||
],
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user