Fe overhaul docs (#1640)

* api changes

* doc changes

* move docs

* generated

* generate

* pkg

* backmerge main

* revert to main

* revert main

* race?

* remove go tests
This commit is contained in:
Gabe Ruttner
2025-04-30 17:10:09 -04:00
committed by GitHub
parent 799b5d0dcf
commit 8e80faf2d6
1503 changed files with 36645 additions and 1235 deletions

View File

@@ -0,0 +1,42 @@
import asyncio
from contextlib import suppress
from hatchet_sdk import Context, EmptyModel, Hatchet
hatchet = Hatchet(debug=True)
existing_loop_worker = hatchet.workflow(name="WorkerExistingLoopWorkflow")
@existing_loop_worker.task()
async def task(input: EmptyModel, ctx: Context) -> dict[str, str]:
print("started")
await asyncio.sleep(10)
print("finished")
return {"result": "returned result"}
async def async_main() -> None:
worker = None
try:
worker = hatchet.worker(
"test-worker", slots=1, workflows=[existing_loop_worker]
)
worker.start()
ref = existing_loop_worker.run_no_wait()
print(await ref.aio_result())
while True:
await asyncio.sleep(1)
finally:
if worker:
await worker.exit_gracefully()
def main() -> None:
with suppress(KeyboardInterrupt):
asyncio.run(async_main())
if __name__ == "__main__":
main()