You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/06 17:23:08 UTC

[GitHub] [spark] dongjoon-hyun opened a new pull request, #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

dongjoon-hyun opened a new pull request, #38943:
URL: https://github.com/apache/spark/pull/38943

   <!--
   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://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041330497


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -398,6 +410,10 @@ class ExecutorPodsAllocator(
     // Check reusable PVCs for this executor allocation batch
     val reusablePVCs = getReusablePVCs(applicationId, pvcsInUse)
     for ( _ <- 0 until numExecutorsToAllocate) {
+      if (reusablePVCs.isEmpty && reusePVC && maxPVCs <= PVC_COUNTER.get()) {

Review Comment:
   Is `reusablePVCs` always less than or equal to `maxPVCs`?



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340220604

   Do you mean that `.delete()` can fail, @tedyu ?


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] tedyu commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
tedyu commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340205543

   I think the `PVC_COUNTER` should only be decremented when the pod deletion happens (in response to error).
   @dongjoon-hyun 
   What do you think of the following change ?
   ```
   diff --git a/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala b/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala
   index 4188a9038a..63fc29ea80 100644
   --- a/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala
   +++ b/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala
   @@ -433,6 +433,7 @@ class ExecutorPodsAllocator(
            podWithAttachedContainer, resolvedExecutorSpec.executorKubernetesResources, reusablePVCs)
          val createdExecutorPod =
            kubernetesClient.pods().inNamespace(namespace).resource(podWithAttachedContainer).create()
   +      var success = 0
          try {
            addOwnerReference(createdExecutorPod, resources)
            resources
   @@ -445,6 +446,7 @@ class ExecutorPodsAllocator(
                logInfo(s"Trying to create PersistentVolumeClaim ${pvc.getMetadata.getName} with " +
                  s"StorageClass ${pvc.getSpec.getStorageClassName}")
                kubernetesClient.persistentVolumeClaims().inNamespace(namespace).resource(pvc).create()
   +            success += 1
                PVC_COUNTER.incrementAndGet()
              }
            newlyCreatedExecutors(newExecutorId) = (resourceProfileId, clock.getTimeMillis())
   @@ -455,8 +457,12 @@ class ExecutorPodsAllocator(
                .inNamespace(namespace)
                .resource(createdExecutorPod)
                .delete()
   -          PVC_COUNTER.decrementAndGet()
   +          if (success == 1) {
   +            success += 1
   +          }
              throw e
   +      } finally {
   +          if (success == 2) PVC_COUNTER.decrementAndGet()
          }
        }
      }
   ```
   If pvc isn't created successfully, it seems the counter shouldn't be decremented.


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041352722


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -398,6 +410,10 @@ class ExecutorPodsAllocator(
     // Check reusable PVCs for this executor allocation batch
     val reusablePVCs = getReusablePVCs(applicationId, pvcsInUse)
     for ( _ <- 0 until numExecutorsToAllocate) {
+      if (reusablePVCs.isEmpty && reusePVC && maxPVCs <= PVC_COUNTER.get()) {

Review Comment:
   So even `maxPVCs <= PVC_COUNTER.get()`, if `reusablePVCs` is not empty, the driver will continue executor pod allocation?



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041345486


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -398,6 +410,10 @@ class ExecutorPodsAllocator(
     // Check reusable PVCs for this executor allocation batch
     val reusablePVCs = getReusablePVCs(applicationId, pvcsInUse)
     for ( _ <- 0 until numExecutorsToAllocate) {
+      if (reusablePVCs.isEmpty && reusePVC && maxPVCs <= PVC_COUNTER.get()) {

Review Comment:
   Thank you for review.
   
   Theoretically, `reusablePVCs` are all driver-owned PVCs whose creation time is bigger than `podAllocationDelay` + now. So, it can be bigger than `maxPVCs` is there is other PVC creation logic (For example, Spark driver plugin).
   
   https://github.com/apache/spark/blob/89b2ee27d258dec8fe265fa862846e800a374d8e/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala#L364-L382
   
   Also, previously, Spark creates new pod and PVCs when some executors are dead. In that case, PVCs could be created a little 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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041376046


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -398,6 +410,10 @@ class ExecutorPodsAllocator(
     // Check reusable PVCs for this executor allocation batch
     val reusablePVCs = getReusablePVCs(applicationId, pvcsInUse)
     for ( _ <- 0 until numExecutorsToAllocate) {
+      if (reusablePVCs.isEmpty && reusePVC && maxPVCs <= PVC_COUNTER.get()) {

Review Comment:
   Yes, correct! When we have `reusablePVCs`, `PVC-oriented executor pod allocation` doesn't need to be blocked. We halts `executor allocation` only when there is no available PVCs and reached `PVC_COUNTER` is greater than or equal to the maximum .



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041347366


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/Config.scala:
##########
@@ -101,6 +100,17 @@ private[spark] object Config extends Logging {
       .booleanConf
       .createWithDefault(true)
 
+  val KUBERNETES_DRIVER_WAIT_TO_REUSE_PVC =
+    ConfigBuilder("spark.kubernetes.driver.waitToReusePersistentVolumeClaims")
+      .doc("If true, driver pod counts the number of created on-demand persistent volume claims " +
+        s"and wait if the number is greater than or equal to the maximum which is " +
+        s"${EXECUTOR_INSTANCES.key} or ${DYN_ALLOCATION_MAX_EXECUTORS.key}. " +
+        s"This config requires both ${KUBERNETES_DRIVER_OWN_PVC.key}=true and " +
+        s"${KUBERNETES_DRIVER_REUSE_PVC.key}=true.")

Review Comment:
   Yes, initially, I tried to use it as a config name but `PVC-oriented executor pod allocation` was achieved by three configurations.
   - spark.kubernetes.driver.waitToReusePersistentVolumeClaims
   - spark.kubernetes.driver.ownPersistentVolumeClaims
   - spark.kubernetes.driver.reusePersistentVolumeClaims
   
   I'll add a K8s document section with that name.



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340084776

   Thank you, @viirya . All test passed. Merged to master for Apache Spark 3.4.0.
   I'll proceed to the documentation as the next PR.


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] tedyu commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
tedyu commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340221769

   Yeah - the `delete` in catch block may fail.
   There could be other error, say prior to the creation of PVC.


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041333237


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/Config.scala:
##########
@@ -101,6 +100,17 @@ private[spark] object Config extends Logging {
       .booleanConf
       .createWithDefault(true)
 
+  val KUBERNETES_DRIVER_WAIT_TO_REUSE_PVC =
+    ConfigBuilder("spark.kubernetes.driver.waitToReusePersistentVolumeClaims")
+      .doc("If true, driver pod counts the number of created on-demand persistent volume claims " +
+        s"and wait if the number is greater than or equal to the maximum which is " +
+        s"${EXECUTOR_INSTANCES.key} or ${DYN_ALLOCATION_MAX_EXECUTORS.key}. " +
+        s"This config requires both ${KUBERNETES_DRIVER_OWN_PVC.key}=true and " +
+        s"${KUBERNETES_DRIVER_REUSE_PVC.key}=true.")

Review Comment:
   Why not to mention `PVC-oriented executor pod allocation` in the config description? I think it is more clear on what this feature is.



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun closed pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun closed pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation
URL: https://github.com/apache/spark/pull/38943


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340224815

   In case of creation failure, `PVC_COUNTER.incrementAndGet()` is not invoked.
   https://github.com/apache/spark/blob/e58f12d1843af39ed4ac0c2ff108490ae303e7e4/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala#L447-L448
   
   In case of deletion failure, `PVC_COUNTER.decrementAndGet()` is not invoked.
   https://github.com/apache/spark/blob/e58f12d1843af39ed4ac0c2ff108490ae303e7e4/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala#L454-L458
   
   So, we had better remove `PVC_COUNTER.decrementAndGet()`, right? If you agree, I will make a follow-up for the deletion of `PVC_COUNTER.decrementAndGet()`.
   
   


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340230713

   I commented on your PR.


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340280345

   Here is a PR including test case to address the comment.
   - https://github.com/apache/spark/pull/38949


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041414732


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -47,6 +48,17 @@ class ExecutorPodsAllocator(
 
   private val EXECUTOR_ID_COUNTER = new AtomicInteger(0)
 
+  private val PVC_COUNTER = new AtomicInteger(0)
+
+  private val maxPVCs = if (Utils.isDynamicAllocationEnabled(conf)) {
+    conf.get(DYN_ALLOCATION_MAX_EXECUTORS)
+  } else {
+    conf.getInt(EXECUTOR_INSTANCES.key, DEFAULT_NUMBER_EXECUTORS)
+  }
+
+  private val reusePVC = conf.get(KUBERNETES_DRIVER_OWN_PVC) &&
+    conf.get(KUBERNETES_DRIVER_REUSE_PVC) && conf.get(KUBERNETES_DRIVER_WAIT_TO_REUSE_PVC)

Review Comment:
   I think this named `reusePVC` is a bit confused. Isn't it the combination of three configs you mentioned (https://github.com/apache/spark/pull/38943/files#r1041347366)?
   
   Maybe `podAllocOnPVC`?



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041445654


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -47,6 +48,17 @@ class ExecutorPodsAllocator(
 
   private val EXECUTOR_ID_COUNTER = new AtomicInteger(0)
 
+  private val PVC_COUNTER = new AtomicInteger(0)
+
+  private val maxPVCs = if (Utils.isDynamicAllocationEnabled(conf)) {
+    conf.get(DYN_ALLOCATION_MAX_EXECUTORS)
+  } else {
+    conf.getInt(EXECUTOR_INSTANCES.key, DEFAULT_NUMBER_EXECUTORS)
+  }
+
+  private val reusePVC = conf.get(KUBERNETES_DRIVER_OWN_PVC) &&
+    conf.get(KUBERNETES_DRIVER_REUSE_PVC) && conf.get(KUBERNETES_DRIVER_WAIT_TO_REUSE_PVC)

Review Comment:
   You are right. Let me rename~



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041378394


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -47,6 +48,17 @@ class ExecutorPodsAllocator(
 
   private val EXECUTOR_ID_COUNTER = new AtomicInteger(0)
 
+  private val PVC_COUNTER = new AtomicInteger(0)
+
+  private val maxPVCs = if (Utils.isDynamicAllocationEnabled(conf)) {
+    conf.get(DYN_ALLOCATION_MAX_EXECUTORS)
+  } else {
+    conf.getInt(EXECUTOR_INSTANCES.key, DEFAULT_NUMBER_EXECUTORS)
+  }
+
+  private val reusePVC = conf.get(KUBERNETES_DRIVER_OWN_PVC) &&
+    conf.get(KUBERNETES_DRIVER_REUSE_PVC) && conf.get(KUBERNETES_DRIVER_WAIT_TO_REUSE_PVC)

Review Comment:
   Hmm, if don't use `KUBERNETES_DRIVER_WAIT_TO_REUSE_PVC`, cannot we still reuse PVCs?



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] tedyu commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
tedyu commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340229735

   The catch block handles errors beyond PVC creation failure.
   ```
           case NonFatal(e) =>
   ```
   Execution may not reach the `resource(pvc).create()` call.
   So we would know the cause if additional flag, `success` above, is introduced.
   
   The `decrementAndGet` call should be executed in the scenario shown in https://github.com/apache/spark/pull/38948


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] viirya commented on a diff in pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
viirya commented on code in PR #38943:
URL: https://github.com/apache/spark/pull/38943#discussion_r1041330497


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala:
##########
@@ -398,6 +410,10 @@ class ExecutorPodsAllocator(
     // Check reusable PVCs for this executor allocation batch
     val reusablePVCs = getReusablePVCs(applicationId, pvcsInUse)
     for ( _ <- 0 until numExecutorsToAllocate) {
+      if (reusablePVCs.isEmpty && reusePVC && maxPVCs <= PVC_COUNTER.get()) {

Review Comment:
   Is `reusablePVCs` already less than or equal to `maxPVCs`?



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #38943: [SPARK-41410][K8S] Support PVC-oriented executor pod allocation

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #38943:
URL: https://github.com/apache/spark/pull/38943#issuecomment-1340215003

   Thank you for review, @tedyu . 
   Could you make a PR with valid test case for your claim?
   BTW, technically, a single pod can have multiple PVCs. So `success == 2` is incorrect in your suggestion. You need to fix that in your PR. 


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org