mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-31 05:39:41 -06:00
* 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>
38 lines
1.0 KiB
Python
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()
|