[GitHub] [zeppelin] felixcheung commented on a change in pull request #3337: [ZEPPELIN-4078] Ipython queue performance

2019-03-23 Thread GitBox
felixcheung commented on a change in pull request #3337: [ZEPPELIN-4078] 
Ipython queue performance
URL: https://github.com/apache/zeppelin/pull/3337#discussion_r268418796
 
 

 ##
 File path: python/src/main/resources/grpc/python/ipython_server.py
 ##
 @@ -52,24 +52,19 @@ def execute(self, request, context):
 print("execute code:\n")
 print(request.code.encode('utf-8'))
 sys.stdout.flush()
-stdout_queue = queue.Queue(maxsize = 10)
-stderr_queue = queue.Queue(maxsize = 10)
-image_queue = queue.Queue(maxsize = 5)
-
+stream_reply_queue = queue.Queue(maxsize = 20)
 
 Review comment:
   ok, what happens when the queue is full?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3337: [ZEPPELIN-4078] Ipython queue performance

2019-03-21 Thread GitBox
felixcheung commented on a change in pull request #3337: [ZEPPELIN-4078] 
Ipython queue performance
URL: https://github.com/apache/zeppelin/pull/3337#discussion_r267638063
 
 

 ##
 File path: python/src/main/resources/grpc/python/ipython_server.py
 ##
 @@ -52,24 +52,19 @@ def execute(self, request, context):
 print("execute code:\n")
 print(request.code.encode('utf-8'))
 sys.stdout.flush()
-stdout_queue = queue.Queue(maxsize = 10)
-stderr_queue = queue.Queue(maxsize = 10)
-image_queue = queue.Queue(maxsize = 5)
-
+stream_reply_queue = queue.Queue(maxsize = 20)
 
 Review comment:
   should maxsize be a bit more?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] felixcheung commented on a change in pull request #3337: [ZEPPELIN-4078] Ipython queue performance

2019-03-21 Thread GitBox
felixcheung commented on a change in pull request #3337: [ZEPPELIN-4078] 
Ipython queue performance
URL: https://github.com/apache/zeppelin/pull/3337#discussion_r267637879
 
 

 ##
 File path: python/src/main/resources/grpc/python/ipython_server.py
 ##
 @@ -52,24 +52,19 @@ def execute(self, request, context):
 print("execute code:\n")
 print(request.code.encode('utf-8'))
 sys.stdout.flush()
-stdout_queue = queue.Queue(maxsize = 10)
-stderr_queue = queue.Queue(maxsize = 10)
-image_queue = queue.Queue(maxsize = 5)
-
+stream_reply_queue = queue.Queue(maxsize = 20)
+payload_reply = []
 def _output_hook(msg):
 msg_type = msg['header']['msg_type']
 content = msg['content']
 if msg_type == 'stream':
-stdout_queue.put(content['text'])
+
stream_reply_queue.put(ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS, 
type=ipython_pb2.TEXT, output=content['text']))
+elif msg_type == 'error':
+
stream_reply_queue.put(ipython_pb2.ExecuteResponse(status=ipython_pb2.ERROR, 
type=ipython_pb2.TEXT, output='\n'.join(content['traceback'])))
 elif msg_type in ('display_data', 'execute_result'):
-stdout_queue.put(content['data'].get('text/plain', ''))
+
stream_reply_queue.put(ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS, 
type=ipython_pb2.TEXT, output=content['data'].get('text/plain', '')))
 if 'image/png' in content['data']:
-image_queue.put(content['data']['image/png'])
-elif msg_type == 'error':
-stderr_queue.put('\n'.join(content['traceback']))
-
-
-payload_reply = []
+
stream_reply_queue.put(ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS, 
type=ipython_pb2.IMAGE, output=content['data']['image/png']))
 
 Review comment:
   this is a bit long and hard to read? consider refactor 
`stream_reply_queue.put` into a separate line


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services