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

url is hardcoded to http://fastapi:8000 but how to handle not using docker compose? #8

Closed
robmarkcole opened this issue Jun 29, 2020 · 1 comment

Comments

@robmarkcole
Copy link

The current approach of hardcoding http://fastapi:8000 requires the use of docker compose, but how do we also handle the case that users are running the containers seperately? A situation where this occurs might be if you want to run the pytorch model on a dedicate GPU machine, and have this resource shared by multiple services (e.g.a web UI, some analytics tools). One option I used here is to pass the machine IP in via an environment variable like:

    environment: 
      - DEEPSTACK_IP=deepstack

Anyway I raise this in the hope you have an even better suggestion. It would be great to identify the optimum solutions and share this back with the community :-)

@davidefiocco
Copy link
Owner

davidefiocco commented Oct 18, 2020

Hi @robmarkcole sorry for the late reply, this comes late as I didn't feel confident about "state of the art" patterns to deal with ML serving beyond the simple example in the repo.

The current solution could indeed be modified to run the containers on different hosts. The backend container would sit on host A, and then the frontend container running on host B would need to be allowed to make requests to the backend. When deploying the frontend, one would just need to add the address of the host running the backend service (as you do) with an env variable referenced by the code.

I haven't tried that yet, but I assume that a better way to serve the (PyTorch) model is to use https://pytorch.org/serve/rest_api.html (which comes with OpenAPI documentation) and have the frontend sit on another machine allowing to make requests to the API exposed by TorchServe. Unless I am mistaken, this solution wouldn't need to use FastAPI though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants