-
Notifications
You must be signed in to change notification settings - Fork 883
gRPC support for TorchServe #687
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
Merged
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
2142715
refactored torchserve job
harshbafna 77b1356
added grpc server side implementation
harshbafna b75b81a
added protobuff files
harshbafna d46d56a
added grpc server startup
harshbafna fec11bf
fixed valid port test case
harshbafna 22734ba
automated server stub generation through gradle
harshbafna 14cb1eb
enhanced sanity script to validate grpc inference api
harshbafna 199811c
Merge branch 'master' into issue_656
harshbafna 151cdcc
Added grpcio-tools package
harshbafna d1abb5c
fixed path issue in grpc client
harshbafna 48b049c
fixed incorrect exit logic in client script
harshbafna 897d5d7
removed json parse in python gRPC client
harshbafna 0ffc689
removed unnecessary file checkin
harshbafna 3770272
added regression test cases for gRPC regression APIs
harshbafna 585c03f
added tolerance check
harshbafna 79dd23b
added python client stub cleanup
harshbafna 7037e6c
enhanced error handling for inference APIs
harshbafna 5a4a69a
removed unused utility file
harshbafna 438683e
added support for datafile driven management api test collection
shivamshriwas 90bfde4
added gRPC support for management APIs
harshbafna 7e3ccaa
added minor fixes found during testing
harshbafna ee0f057
enhanced grpc pytest suite to use grpc client for registering and unr…
harshbafna 78533c2
updated command to generate python client stubs
harshbafna dfbffa3
removed netty http staus dependency from wlm framework
harshbafna 2a529cd
refacroted common code to utility module
harshbafna 6b70aba
added gRPC management api test cases in regression suite and minor fixes
harshbafna 747e506
added ping api
harshbafna 8413651
removed grpc metric api
harshbafna 328bb4e
added ssl support for gRPC server
harshbafna 0c1795d
added documentation
harshbafna ff25175
Merge branch 'master' into issue_656
harshbafna 1822ae3
fixed issue after conflict resolution
harshbafna 039f48c
added reference to python gRPC client, used in regression suite, in g…
harshbafna 126532e
added validation for register and unregister model in sanity script
harshbafna ca76ede
updated docs
harshbafna 6eb737f
minor fixes in grpc doc
harshbafna d27495c
updated gRPC server await termination code
harshbafna 0b7eabf
refactored gRPC server startup code
harshbafna 15322c6
added null check before terminating gRPC servers
harshbafna 590fca8
minor refactoring of method name
harshbafna 5b3a6b5
skipped grpc package from jacoco verification
harshbafna 63aa51a
Fixed typo in doc
harshbafna 461395b
added error logs in gRPC client
harshbafna 653276e
added gRPC server interceptor to log api access data
harshbafna f1a6227
added checkstyle fixes
harshbafna e78dbff
fixed grpc command in readme
harshbafna 3bb125a
refactored test cases to removed code duplication
harshbafna 4fa484a
Merge branch 'master' into issue_656
harshbafna 2b867a0
Merge branch 'master' into issue_656
harshbafna 3d7b0b9
Fixed typo in link.
harshbafna 8dac80c
merge master
harshbafna 700defc
fixed compilation issues after conflict resolution
harshbafna dc8e410
Merge branch 'master' into issue_656
harshbafna 01bedc8
Merge branch 'master' into issue_656
harshbafna 22d1b06
Merge branch 'master' into issue_656
harshbafna f5818ca
fixed regression suite pytest issue
harshbafna 410ce11
fixed pytest case
harshbafna 1bd835d
Merge branch 'master' into issue_656
harshbafna 7aa38dd
Merge branch 'master' into issue_656
dk19y c617166
merged master and resolved conflicts
harshbafna a8f3f7f
fixed import
harshbafna c2c48a0
fixed sanity suite
harshbafna 0466290
Merge branch 'master' into issue_656
dk19y ab7be17
Merge branch 'master' into issue_656
maaquib 5cf2af0
Merge branch 'master' into issue_656
chauhang d113274
merged master and resolved conflicts
harshbafna c3774d2
fixed path in grpc client stub generation
harshbafna 5d62f22
fixed path for grpc client
harshbafna ac33310
Merge branch 'master' into issue_656
maaquib 0422f09
Merge branch 'master' into issue_656
harshbafna 8b68184
incorporated code review comments
harshbafna 35af895
Merge branch 'master' into issue_656
chauhang 591f3ec
merged master and resolved conflicts
harshbafna c17eee8
Merge branch 'issue_656' of https://github.com/pytorch/serve into iss…
harshbafna 26cfa0a
Merge branch 'master' into issue_656
harshbafna ccdd310
Merge branch 'master' into issue_656
harshbafna 557f51e
fixed management api newman command
harshbafna d9bf3a7
Merge branch 'master' into issue_656
harshbafna 4dfdecc
fixed import issues
harshbafna b21a174
fixed regression pytest issues
harshbafna 5e015f4
Merge branch 'master' into issue_656
maaquib File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# TorchServe gRPC API | ||
|
||
TorchServe also supports [gRPC APIs](../frontend/server/src/main/resources/proto) for both inference and management calls. | ||
|
||
TorchServe provides following gRPCs apis | ||
|
||
* [Inference API](../frontend/server/src/main/resources/proto/inference.proto) | ||
- **Ping** : Gets the health status of the running server | ||
- **Predictions** : Gets predictions from the served model | ||
|
||
* [Management API](../frontend/server/src/main/resources/proto/management.proto) | ||
- **RegisterModel** : Serve a model/model-version on TorchServe | ||
- **UnregisterModel** : Free up system resources by unregistering specific version of a model from TorchServe | ||
- **ScaleWorker** : Dynamically adjust the number of workers for any version of a model to better serve different inference request loads. | ||
- **ListModels** : Query default versions of current registered models | ||
- **DescribeModel** : Get detail runtime status of default version of a model | ||
- **SetDefault** : Set any registered version of a model as default version | ||
|
||
By default, TorchServe listens on port 9090 for the gRPC Inference API and 9091 for the gRPC Management API. | ||
To configure gRPC APIs on different ports refer [configuration documentation](configuration.md) | ||
|
||
## Python client example for gRPC APIs | ||
|
||
Run following commands to Register, run inference and unregister, densenet161 model from [TorchServe model zoo](model_zoo.md) using [gRPC python client](../scripts/torchserve_grpc_client.py). | ||
|
||
- [Install TorchServe](../README.md#install-torchserve) | ||
|
||
- Clone serve repo to run this example | ||
|
||
```bash | ||
git clone | ||
cd serve | ||
``` | ||
|
||
- Install gRPC python dependencies | ||
|
||
```bash | ||
pip install -U grpcio protobuf grpcio-tools | ||
``` | ||
|
||
- Start torchServe | ||
|
||
```bash | ||
mkdir model_store | ||
torchserve --start | ||
``` | ||
|
||
- Generate python gRPC client stub using the proto files | ||
|
||
```bash | ||
python -m grpc_tools.protoc --proto_path=frontend/server/src/main/resources/proto/ --python_out=scripts --grpc_python_out=scripts frontend/server/src/main/resources/proto/inference.proto frontend/server/src/main/resources/proto/management.proto | ||
``` | ||
|
||
- Register densenet161 model | ||
|
||
```bash | ||
python scripts/torchserve_grpc_client.py register densenet161 | ||
``` | ||
|
||
- Run inference using | ||
|
||
```bash | ||
python scripts/torchserve_grpc_client.py infer densenet161 examples/image_classifier/kitten.jpg | ||
``` | ||
|
||
- Unregister densenet161 model | ||
|
||
```bash | ||
python scripts/torchserve_grpc_client.py unregister densenet161 | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.