You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2019/03/21 07:00:26 UTC

[GitHub] [zeppelin] felixcheung commented on a change in pull request #3336: [ZEPPELIN-4078] Fix concurrent autocomplete and execute for Ipython

felixcheung commented on a change in pull request #3336: [ZEPPELIN-4078] Fix concurrent autocomplete and execute for Ipython
URL: https://github.com/apache/zeppelin/pull/3336#discussion_r267638285
 
 

 ##########
 File path: python/src/main/resources/grpc/python/ipython_server.py
 ##########
 @@ -72,29 +76,30 @@ def _output_hook(msg):
         payload_reply = []
         def execute_worker():
             reply = self._kc.execute_interactive(request.code,
-                                            output_hook=_output_hook,
-                                            timeout=TIMEOUT)
+                                        output_hook=_output_hook,
+                                        timeout=TIMEOUT)
             payload_reply.append(reply)
 
         t = threading.Thread(name="ConsumerThread", target=execute_worker)
-        t.start()
-
-        while t.is_alive():
-            while not stdout_queue.empty():
-                output = stdout_queue.get()
-                yield ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS,
-                                                  type=ipython_pb2.TEXT,
-                                                  output=output)
-            while not stderr_queue.empty():
-                output = stderr_queue.get()
-                yield ipython_pb2.ExecuteResponse(status=ipython_pb2.ERROR,
-                                                  type=ipython_pb2.TEXT,
-                                                  output=output)
-            while not image_queue.empty():
-                output = image_queue.get()
-                yield ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS,
-                                                  type=ipython_pb2.IMAGE,
-                                                  output=output)
+        with self._lock:
 
 Review comment:
   isn't this going to lock the entire time the thread is running?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services