AyWa 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_r267639690
 
 

 ##########
 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:
   Indeed, it will. But this is the expected behavior. Right now, if you do an 
other request to the kernel (auto-complete), the `execute_interactive` will 
never complete. 

----------------------------------------------------------------
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

Reply via email to