Files
hatchet/examples/python/bulk_operations/worker.py
Matt Kaye a73e34cd92 Feat: Batched replays (#1860)
* feat: batched replays

* fix: add some comments

* feat: e2e test for bulk replays

* chore: gen

* fix: improving tests a bit

* fix: copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: gen

* fix: tag

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-13 13:47:50 -04:00

38 lines
1.0 KiB
Python

from hatchet_sdk import Context, EmptyModel, Hatchet
hatchet = Hatchet(debug=True)
@hatchet.task()
def bulk_replay_test_1(input: EmptyModel, ctx: Context) -> None:
print("retrying bulk replay test task", ctx.retry_count)
if ctx.retry_count == 0:
raise ValueError("This is a test error to trigger a retry.")
@hatchet.task()
def bulk_replay_test_2(input: EmptyModel, ctx: Context) -> None:
print("retrying bulk replay test task", ctx.retry_count)
if ctx.retry_count == 0:
raise ValueError("This is a test error to trigger a retry.")
@hatchet.task()
def bulk_replay_test_3(input: EmptyModel, ctx: Context) -> None:
print("retrying bulk replay test task", ctx.retry_count)
if ctx.retry_count == 0:
raise ValueError("This is a test error to trigger a retry.")
def main() -> None:
worker = hatchet.worker(
"bulk-replay-test-worker",
workflows=[bulk_replay_test_1, bulk_replay_test_2, bulk_replay_test_3],
)
worker.start()
if __name__ == "__main__":
main()