Files
hatchet/examples/python/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

22 lines
523 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"}