Lightning-AI / LitServe

Lightning-fast serving engine for any AI model of any size. Flexible. Easy. Enterprise-scale.
https://lightning.ai/docs/litserve
Apache License 2.0
2.51k stars 160 forks source link

LitServe server doesn't crash when there is a failure in setup #347

Closed tchaton closed 2 weeks ago

tchaton commented 4 weeks ago

šŸ› Bug

To Reproduce

Attach a Lightning Studio which is fully reproducible (code, dependencies, environment, etc...) to reproduce this:

  1. Create a Studio.
  2. Reproduce the issue in the Studio.
  3. Publish the Studio.
  4. Paste the Studio link here.
from litserve import LitAPI, LitServer

class DebugLitAPI(LitAPI):
    def setup(self, device):
        raise Exception

    def predict(self, inputs):
        return None

if __name__ == "__main__":
    api = DebugLitAPI()
    server = LitServer(api, accelerator='auto', devices='auto', workers_per_device=2)
    server.run(port=8000)

Instead, it should return exit code error 1.

Code sample

Expected behavior

Environment

If you published a Studio with your bug report, we can automatically get this information. Otherwise, please describe:

Additional context

Borda commented 3 weeks ago

seems to be the same as #293

grumpyp commented 3 weeks ago

I'd like to improve that, @aniketmaurya, anything I should take into account when working on it?

aniketmaurya commented 2 weeks ago

sure go ahead @grumpyp!! we call lit_api.setup here. Probably we can do a check if the started workers successfully called setup or not here.