66from clarifai_grpc .channel .grpc_json_channel import GRPCJSONChannel
77
88RETRIES = 2 # if connections fail retry a couple times.
9- CONNECTIONS = 20 # number of connections to maintain in pool.
10- MAX_MESSAGE_LENGTH = 128 * 1024 * 1024 # 128MB
9+ CONNECTIONS = (
10+ 20 # number of connections to maintain in pool, only usd for json channel, not direct GRPC.
11+ )
12+ MAX_MESSAGE_LENGTH = 1024 * 1024 * 1024 # 1GB
1113
1214wrap_response_deserializer = None
1315
@@ -87,6 +89,7 @@ def get_grpc_channel(base=None, root_certificates_path=None):
8789 options = [
8890 ("grpc.service_config" , grpc_json_config ),
8991 ("grpc.max_receive_message_length" , MAX_MESSAGE_LENGTH ),
92+ ("grpc.max_send_message_length" , MAX_MESSAGE_LENGTH ),
9093 ],
9194 )
9295
@@ -108,6 +111,7 @@ def get_insecure_grpc_channel(base=None, port=18080):
108111 options = [
109112 ("grpc.service_config" , grpc_json_config ),
110113 ("grpc.max_receive_message_length" , MAX_MESSAGE_LENGTH ),
114+ ("grpc.max_send_message_length" , MAX_MESSAGE_LENGTH ),
111115 ],
112116 )
113117
@@ -136,6 +140,7 @@ def get_aio_grpc_channel(base=None, root_certificates_path=None):
136140 options = [
137141 ("grpc.service_config" , grpc_json_config ),
138142 ("grpc.max_receive_message_length" , MAX_MESSAGE_LENGTH ),
143+ ("grpc.max_send_message_length" , MAX_MESSAGE_LENGTH ),
139144 ],
140145 )
141146
@@ -157,5 +162,6 @@ def get_aio_insecure_grpc_channel(base=None, port=18080):
157162 options = [
158163 ("grpc.service_config" , grpc_json_config ),
159164 ("grpc.max_receive_message_length" , MAX_MESSAGE_LENGTH ),
165+ ("grpc.max_send_message_length" , MAX_MESSAGE_LENGTH ),
160166 ],
161167 )
0 commit comments