turboFei commented on a change in pull request #1377:
URL: https://github.com/apache/incubator-kyuubi/pull/1377#discussion_r749880114



##########
File path: 
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/LaunchEngine.scala
##########
@@ -37,21 +42,28 @@ class LaunchEngine(session: KyuubiSessionImpl, override val 
shouldRunAsync: Bool
     setState(OperationState.PENDING)
   }
 
-  override protected def afterRun(): Unit = {
-    OperationLog.removeCurrentOperationLog()
-  }
+  override protected def afterRun(): Unit = { }
 
   override protected def runInternal(): Unit = {
     val asyncOperation: Runnable = () => {
       setState(OperationState.RUNNING)
       try {
-        session.openEngineSession()
+        session.openEngineSession(getOperationLog)
         setState(OperationState.FINISHED)
       } catch {
         onError()
       } finally {
-        // TODO: delay to close it for async mode to enable client to get more 
launch engine log
-        session.closeOperation(getHandle)
+        new Thread(s"close-launch-engine-op-${getHandle}") {
+          override def run(): Unit = {
+            if (shouldRunAsync) {
+              // delay to close it for async mode to enable client to get more 
launch engine log
+              Thread.sleep(DEFAULT_LAUNCH_ENGINE_OPERATION_CLOSE_DELAY)
+            }
+            if (!isClosedOrCanceled) {
+              session.closeOperation(getHandle)
+            }
+          }
+        }.start()

Review comment:
       make senses




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to