-
Notifications
You must be signed in to change notification settings - Fork 280
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
C++ Model Container #249
C++ Model Container #249
Conversation
Test FAILed. |
Looks great! Let me know when it's ready for review. |
Test PASSed. |
Test FAILed. |
@dcrankshaw This is ready for review. |
Test PASSed. |
Test FAILed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcrankshaw Addressed your comments
@@ -170,7 +170,7 @@ RPC requests sent from Clipper to model containers are divided into two categori | |||
### Serializing Prediction Requests | |||
1. All requests begin with a 32-bit integer header, sent as a single ZeroMQ message. The value of this integer will be 0, indicating that the request is a prediction request. | |||
|
|||
2. The second ZeroMQ message contains the size of the input header, in bytes, as a 64-bit long. This is the size of the content of the third ZeroMQ message. | |||
2. The second ZeroMQ message contains the size of the input header, in bytes, as a 32-bit integer. This is the size of the content of the third ZeroMQ message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize that a C++ long is equivalent to a uint32_t, so the correct input header input type has always been 32-bit integer and the docs need this correction.
} | ||
|
||
const std::vector<Input<D>> get_string_inputs( | ||
const std::vector<int>& /*input_header*/, long input_content_size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. See the bottom of the "Serializing Prediction Requests" section of container_implementation.md
@@ -17,6 +17,7 @@ using QueryId = long; | |||
using FeedbackAck = bool; | |||
|
|||
enum class InputType { | |||
Invalid = -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the Invalid
type to for the purpose of defining the input_trait
struct in container_rpc.hpp
. This trait allows us to infer the InputType
enum categorization for the based on the type of Input<D>
that a user's model is parameterized with (ByteVector
, DoubleVector
).
[this, clipper_address, &model, model_name, model_version]() { | ||
serve_model(model, model_name, model_version, clipper_address); | ||
}); | ||
serving_thread_.detach(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
template <typename D> | ||
void serve_model(Model<Input<D>>& model, std::string model_name, | ||
int model_version, std::string clipper_address) { | ||
zmq::context_t context(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context is responsible for initializing and providing IO threads used by ZMQ socket s(See http://api.zeromq.org/2-1:zmq-cpp # Context).
The 1
indicates that our context has a single IO thread. I've added documentation to this effect.
int num_splits = input_header[1] - 1; | ||
std::vector<Input<D>> inputs; | ||
int prev_split = 0; | ||
// Iterate from the beginning of the input data content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. This should say "input header content" instead of "input data content". Fixed.
int prev_split = 0; | ||
// Iterate from the beginning of the input data content | ||
// (the first two elements of the header are metadata) | ||
for (int i = 2; i < num_splits + 2; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// Do nothing for now | ||
break; | ||
|
||
default: break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an exception
log_error_formatted( | ||
LOGGING_TAG_CONTAINER, | ||
"Received erroneous new container message from Clipper!"); | ||
default: break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - added an exception
break; | ||
|
||
case RequestType::FeedbackRequest: | ||
// Do nothing for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an exception
Test FAILed. |
Test FAILed. |
@dcrankshaw Build is failing due to code format violations that the |
Test FAILed. |
Test FAILed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I formatted the code so as long as the tests pass I'll merge this.
jenkins test this please |
Test PASSed. |
No description provided.