Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamlit requests may fail if FastAPI backend hasn't initialized yet #6

Open
davidefiocco opened this issue Jun 28, 2020 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@davidefiocco
Copy link
Owner

davidefiocco commented Jun 28, 2020

As the app is started with docker-compose up, the streamlit service is likely the fastest to come online (the fastapi service needs to do the PyTorch model load). If the user visits the streamlit page and fires a call, the result may be

image

because the fastapi service is not responding yet.

The user should just wait a bit and then results should be returned OK, but it would be better to implement some sort of healthcheck so that streamlit requests can be handled more gracefully.

@robmarkcole
Copy link

This example might help

@davidefiocco davidefiocco added the bug Something isn't working label Sep 5, 2020
@davidefiocco davidefiocco added the help wanted Extra attention is needed label May 11, 2022
@ttamg
Copy link

ttamg commented Dec 2, 2022

Can this not be resolved in the docker-compose file by only starting the streamlit container after the FastAPI service is up and healthy?

Already the project has the depends_on: in the docker-compose. In addition you can add configuration to wait until that fastapi service is up and healthy. The top rated answer here from SvenHornberg gives some details on how to do that in the docker-compose.yml file - https://stackoverflow.com/questions/31746182/docker-compose-wait-for-container-x-before-starting-y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants