aws / sagemaker-inference-toolkit

Serve machine learning models within a 🐳 Docker container using 🧠 Amazon SageMaker.
Apache License 2.0
383 stars 82 forks source link

stop_server function #116

Open Duncan-Haywood opened 1 year ago

Duncan-Haywood commented 1 year ago

A stop_server() function in model_server.py

It would be helpful to include a simple-to-use function for stopping the server. This would be specifically helpful for testing the server locally and tearing it down. This helps in simplicity of use for developers and a high quality, easy experience for users of AWS.

Alternatives: It seems to be possible to go into the multi-model-server code to stop the server when needed. Yet, this requires some digging and switching libraries to do. It seems like it would also be possible to stop the server through managing running process, but this would also require some digging on how to do.

Additional context: After some additional digging, It seems that a call to multi-model-server --stop would do the job, perhaps with some additional modifications. I still think a wrapper for that in this library would make for a better development experience than needing to dive into the source code like that.

Where to find the current source that would handle this: awslabs/multi-model-server/mms/model_server.py in the start() function, line 40 at the time of writing this. There is also reference to awslabs/multi-model-server/mms/arg_parser.py ArgParser class, mms_parser() function -- line 34 at the time of writing this.