Files
hatchet/sdks/python/examples/streaming/async_stream.py
Matt Kaye 3442c11106 Feat: Top-level stream consumer in the SDKs (#1917)
* feat: add stream sub on top level

* feat: clean up examples

* chore: gen

* feat: move stream onto the runs client in ts

* fix: examples

* chore: gen

* fix: circular import issues

* chore: lint

* feat: first pass at Next app

* fix: pull next out to top level

* fix: all the things

* fix: get it all wired up

* fix: imports

* fix: lint rule

* fix: just use js

* fix: revert tsconfig changes

* fix: check in pages

* fix: hangup event in streaming impl

* chore: gen

* chore: generate again, remove lots of nextjs stuff

* fix: one more ignore

* fix: gen

* fix: ignore

* fix: ugh

* fix: simplify a bunch

* fix: lint

* fix: rm gen cruft

* fix: changelog

* feat: implement list with pagination

* feat: add some tests

* feat: add warnings

* fix: update workflow / task methods

* chore: version

* feat: retries
2025-07-03 18:49:16 -04:00

18 lines
425 B
Python

import asyncio
from examples.streaming.worker import hatchet, stream_task
from hatchet_sdk.clients.listeners.run_event_listener import StepRunEventType
async def main() -> None:
# > Consume
ref = await stream_task.aio_run_no_wait()
async for chunk in hatchet.runs.subscribe_to_stream(ref.workflow_run_id):
print(chunk, flush=True, end="")
# !!
if __name__ == "__main__":
asyncio.run(main())