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

Add environment variable to set GRPC_ARG_MAX_MESSAGE_LENGTH #7130

Merged
merged 3 commits into from
Dec 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion oneflow/core/control/ctrl_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ std::array<const grpc::internal::RpcMethod, kCtrlMethodNum> BuildRpcMethods(
return {BuildOneRpcMethod<method_indices>(channel)...};
}

constexpr int64_t kDefaultGrpcMaxMessageByteSize = -1;

} // namespace

CtrlService::Stub::Stub(std::shared_ptr<grpc::ChannelInterface> channel)
Expand All @@ -39,7 +41,9 @@ CtrlService::Stub::Stub(std::shared_ptr<grpc::ChannelInterface> channel)

std::unique_ptr<CtrlService::Stub> CtrlService::NewStub(const std::string& addr) {
grpc::ChannelArguments ch_args;
ch_args.SetInt(GRPC_ARG_MAX_MESSAGE_LENGTH, 64 * 1024 * 1024);
int64_t max_msg_byte_size =
ParseIntegerFromEnv("ONEFLOW_GRPC_MAX_MESSAGE_BYTE_SIZE", kDefaultGrpcMaxMessageByteSize);
ch_args.SetInt(GRPC_ARG_MAX_MESSAGE_LENGTH, max_msg_byte_size);
return std::make_unique<Stub>(
grpc::CreateCustomChannel(addr, grpc::InsecureChannelCredentials(), ch_args));
}
Expand Down