Skip to content

Commit c68bda5

Browse files
committed
feat: coroutines
1 parent 8771532 commit c68bda5

5 files changed

Lines changed: 34 additions & 6 deletions

File tree

simple-examples/poetry.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

simple-examples/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ python-dotenv = "^1.0.0"
1414
openai = "^1.12.0"
1515
beautifulsoup4 = "^4.12.3"
1616
requests = "^2.31.0"
17-
hatchet-sdk = "^0.15.0"
17+
hatchet-sdk = "^0.15.4"
1818

1919
[build-system]
2020
requires = ["poetry-core"]

simple-examples/src/async/__init__.py

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from src.hatchet import hatchet
2+
3+
hatchet.client.event.push(
4+
"async:create",
5+
{
6+
"test": "test"
7+
}
8+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from hatchet_sdk import Context
2+
from src.hatchet import hatchet
3+
import asyncio
4+
5+
6+
@hatchet.workflow(on_events=["async:create"])
7+
class AsyncWorkflow:
8+
9+
@hatchet.step()
10+
async def step1(self, context: Context):
11+
print("sleeping...")
12+
await asyncio.sleep(5)
13+
print("...done sleeping")
14+
15+
return {"step1": "complete!"}
16+
17+
18+
worker = hatchet.worker("example-worker")
19+
worker.register_workflow(AsyncWorkflow())
20+
worker.start()

0 commit comments

Comments
 (0)