You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/04/26 07:40:44 UTC

[GitHub] [incubator-kyuubi] wForget opened a new pull request, #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

wForget opened a new pull request, #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
     2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   close #2419
   
   We need to clean up the ProcBuilder process and engine application when the session is closed.
   
   ### _How was this patch tested?_
   - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#issuecomment-1110515395

   # [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2482](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4fe3c2f) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/7b70a6a0cee7351cb5f77acc57b0b993e47177cd?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7b70a6a) will **increase** coverage by `0.09%`.
   > The diff coverage is `71.42%`.
   
   > :exclamation: Current head 4fe3c2f differs from pull request most recent head ae8be05. Consider uploading reports for the commit ae8be05 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2482      +/-   ##
   ============================================
   + Coverage     63.46%   63.55%   +0.09%     
     Complexity       69       69              
   ============================================
     Files           371      371              
     Lines         17582    17592      +10     
     Branches       2345     2346       +1     
   ============================================
   + Hits          11158    11181      +23     
   + Misses         5392     5374      -18     
   - Partials       1032     1037       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../org/apache/kyuubi/session/KyuubiSessionImpl.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXNzaW9uL0t5dXViaVNlc3Npb25JbXBsLnNjYWxh) | `75.34% <0.00%> (-1.05%)` | :arrow_down: |
   | [...n/scala/org/apache/kyuubi/engine/ProcBuilder.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvUHJvY0J1aWxkZXIuc2NhbGE=) | `82.71% <50.00%> (+1.46%)` | :arrow_up: |
   | [...ain/scala/org/apache/kyuubi/engine/EngineRef.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvRW5naW5lUmVmLnNjYWxh) | `76.92% <83.33%> (+0.15%)` | :arrow_up: |
   | [...g/apache/kyuubi/operation/BatchJobSubmission.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vQmF0Y2hKb2JTdWJtaXNzaW9uLnNjYWxh) | `72.60% <100.00%> (+0.77%)` | :arrow_up: |
   | [...rg/apache/kyuubi/engine/trino/TrinoSqlEngine.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXh0ZXJuYWxzL2t5dXViaS10cmluby1lbmdpbmUvc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9reXV1YmkvZW5naW5lL3RyaW5vL1RyaW5vU3FsRW5naW5lLnNjYWxh) | `59.64% <0.00%> (+7.01%)` | :arrow_up: |
   | [...pache/kyuubi/engine/KyuubiApplicationManager.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvS3l1dWJpQXBwbGljYXRpb25NYW5hZ2VyLnNjYWxh) | `86.36% <0.00%> (+20.45%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [7b70a6a...ae8be05](https://codecov.io/gh/apache/incubator-kyuubi/pull/2482?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on pull request #2482: [KYUUBI #2419] Release engine during closing kyuubi server session if share level is connection

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#issuecomment-1111699318

   thanks, merging to master


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] wForget commented on a diff in pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
wForget commented on code in PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#discussion_r859354847


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala:
##########
@@ -149,7 +149,13 @@ class BatchJobSubmission(session: KyuubiBatchSessionImpl, batchRequest: BatchReq
   override def close(): Unit = {
     if (!isClosedOrCanceled) {
       if (builder != null) {
-        builder.close()
+        try {
+          builder.shutdown()
+          applicationManager.killApplication(builder.clusterManager(), batchId)

Review Comment:
   Thanks, I will revert this



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#discussion_r858913765


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala:
##########
@@ -149,7 +149,13 @@ class BatchJobSubmission(session: KyuubiBatchSessionImpl, batchRequest: BatchReq
   override def close(): Unit = {
     if (!isClosedOrCanceled) {
       if (builder != null) {
-        builder.close()
+        try {
+          builder.shutdown()
+          applicationManager.killApplication(builder.clusterManager(), batchId)

Review Comment:
   For yarn-cluster mode and without application wait completion, it will kill the running spark app.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] wForget commented on a diff in pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
wForget commented on code in PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#discussion_r859296298


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala:
##########
@@ -149,7 +149,13 @@ class BatchJobSubmission(session: KyuubiBatchSessionImpl, batchRequest: BatchReq
   override def close(): Unit = {
     if (!isClosedOrCanceled) {
       if (builder != null) {
-        builder.close()
+        try {
+          builder.shutdown()
+          applicationManager.killApplication(builder.clusterManager(), batchId)

Review Comment:
   > For yarn-cluster mode and without application wait completion, it will kill the running spark app.
   
   Sorry, I mistakenly thought the close method was called when the job finished, so how about we add it in `KyuubiBatchSessionImpl#close`?



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#discussion_r859352244


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala:
##########
@@ -149,7 +149,13 @@ class BatchJobSubmission(session: KyuubiBatchSessionImpl, batchRequest: BatchReq
   override def close(): Unit = {
     if (!isClosedOrCanceled) {
       if (builder != null) {
-        builder.close()
+        try {
+          builder.shutdown()
+          applicationManager.killApplication(builder.clusterManager(), batchId)

Review Comment:
   I think we can keep it with original.
   
   We can only kill the application when killApp option is enabled.
   
   ```
   <h3 dir="auto" style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; font-weight: 600; line-height: 1.25; color: rgb(36, 41, 47); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">DELETE /batches/${batchId}</h3>
   
   Name | Description | Type
   -- | -- | --
   killApp | Whether to kill the running app | Boolean, optional, false by defaults
   
   <br class="Apple-interchange-newline">
   ```



##########
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala:
##########
@@ -149,7 +149,13 @@ class BatchJobSubmission(session: KyuubiBatchSessionImpl, batchRequest: BatchReq
   override def close(): Unit = {
     if (!isClosedOrCanceled) {
       if (builder != null) {
-        builder.close()
+        try {
+          builder.shutdown()
+          applicationManager.killApplication(builder.clusterManager(), batchId)

Review Comment:
   I think we can keep it with original.
   
   We can only kill the application when killApp option is enabled.
   
   <h3 dir="auto" style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; font-weight: 600; line-height: 1.25; color: rgb(36, 41, 47); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">DELETE /batches/${batchId}</h3>
   
   Name | Description | Type
   -- | -- | --
   killApp | Whether to kill the running app | Boolean, optional, false by defaults
   
   <br class="Apple-interchange-newline">



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#discussion_r860380855


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala:
##########
@@ -237,12 +237,20 @@ trait ProcBuilder {
     process
   }
 
-  def close(): Unit = synchronized {
+  def close(): Unit = {
+    close(!waitCompletion)
+  }
+
+  def shutdown(): Unit = {

Review Comment:
   We do not need an another method, just
   ```
   def close(destroyForcibly: Boolean = waitCompletion): Unit = {
   ```



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#discussion_r860385906


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala:
##########
@@ -230,4 +232,16 @@ private[kyuubi] class EngineRef(
         create(discoveryClient, extraEngineLog)
       }
   }
+
+  def close(): Unit = {
+    if (shareLevel == CONNECTION && builder != null) {
+      try {
+        builder.shutdown()
+        engineManager.killApplication(builder.clusterManager(), engineRefId)

Review Comment:
   the ordering is a little confused: we have closed the builder, but get `clusterManager` from it again. It seems better:
   ```scala
   val clusterManager = builder.clusterManager()
   builder.close()
   engineManager.killApplication(clusterManager)
   ```



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you closed pull request #2482: [KYUUBI #2419] Release engine during closing kyuubi server session if share level is connection

Posted by GitBox <gi...@apache.org>.
ulysses-you closed pull request #2482: [KYUUBI #2419] Release engine during closing kyuubi server session if share level is connection
URL: https://github.com/apache/incubator-kyuubi/pull/2482


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] ulysses-you commented on pull request #2482: [KYUUBI #2419] Destroy the ProcBuilder process and call killApplication during closing session

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on PR #2482:
URL: https://github.com/apache/incubator-kyuubi/pull/2482#issuecomment-1111655402

   @wForget thank you for the contribution, I think the title should be refine to:
   `Release engine during closing kyuubi server session if share level is connection` ?


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org