Lightning-AI / Lightning-AI/LitServe
Allow resource release at the end of life of the LitAPI object
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.9k
- Forks
- 304
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 6
Description
🚀 Feature
We have a setup method, which allows one to initialize for each worker the resources needed for inference.
I want the exact reverse: When the server closes, to release the resource (via an abstract teardown method or similar)
Motivation
Some APIs need more than just temporary state (DB connection, prompt files, etc...). Not being able to release them forces one to use garbage collection to release the data, which is an unsafe way to proceed.
Pitch
sequenceDiagram
participant MAIN as parent process
create participant WORKER as worker process
MAIN ->> WORKER: fork()
WORKER ->> WORKER: setup
note over MAIN, WORKER: server lifetime
WORKER ->> WORKER: teardown
destroy WORKER
WORKER ->> MAIN: child process is dead
MAIN ->> MAIN: program finalization
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing setup method through the worker lifecycle and locate the server-shutdown path. Define the teardown lifecycle and verify that it runs for each worker before the process exits, releasing resources such as database connections or prompt files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100