Xilinx / inference-server

https://xilinx.github.io/inference-server/
Apache License 2.0
43 stars 13 forks source link

Refactor globals #125

Closed varunsh-xilinx closed 1 year ago

varunsh-xilinx commented 1 year ago

Summary of Changes

Motivation

Global objects complicate testing and prevent the use of dependency injection. The refactor properly assigns ownership of the shared state of the server to the Server object and firmly couples the NativeClient to the server as well.

Implementation

The shared state of the server is mainly two things: the list of active endpoints and the model repository. These are now owned by the Server object and passed to the HTTP and gRPC servers when those are started. Since the NativeClient directly accesses these methods, it now requires a pointer to the running server and it will get its internal state from there. This way, users are also prevented from creating a NativeClient to communicate with a server they don't have access to.

Notes

There are a few global objects remaining still:

gbuildx commented 1 year ago

Build failed!

varunsh-xilinx commented 1 year ago

Passed internally. Failed initially due to exiting container in use on the test host