Files
hatchet/sdks/python/examples/manual_slot_release/worker.py
Gabe Ruttner 8e80faf2d6 Fe overhaul docs (#1640)
* api changes

* doc changes

* move docs

* generated

* generate

* pkg

* backmerge main

* revert to main

* revert main

* race?

* remove go tests
2025-04-30 14:10:09 -07:00

25 lines
530 B
Python

import time
from hatchet_sdk import Context, EmptyModel, Hatchet
hatchet = Hatchet()
# > SlotRelease
slot_release_workflow = hatchet.workflow(name="SlotReleaseWorkflow")
@slot_release_workflow.task()
def step1(input: EmptyModel, ctx: Context) -> dict[str, str]:
print("RESOURCE INTENSIVE PROCESS")
time.sleep(10)
# 👀 Release the slot after the resource-intensive process, so that other steps can run
ctx.release_slot()
print("NON RESOURCE INTENSIVE PROCESS")
return {"status": "success"}
# !!