This is an automated email from the ASF dual-hosted git repository.
mridulm80 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 4f0db87 [SPARK-35416][K8S][FOLLOWUP] Use Set instead of ArrayBuffer
4f0db87 is described below
commit 4f0db872a089257f1e894060e1757f9e5b973142
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Thu Jun 3 10:41:11 2021 -0500
[SPARK-35416][K8S][FOLLOWUP] Use Set instead of ArrayBuffer
### What changes were proposed in this pull request?
This is a follow-up of https://github.com/apache/spark/pull/32564 .
### Why are the changes needed?
To use Set instead of ArrayBuffer and add a return type.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Pass the CIs.
Closes #32758 from dongjoon-hyun/SPARK-35416-2.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Mridul Muralidharan <mridul<at>gmail.com>
---
.../apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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 3349e0c..606339a 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
@@ -390,8 +390,8 @@ private[spark] class ExecutorPodsAllocator(
private def replacePVCsIfNeeded(
pod: Pod,
resources: Seq[HasMetadata],
- reusablePVCs: mutable.Buffer[PersistentVolumeClaim]) = {
- val replacedResources = mutable.ArrayBuffer[HasMetadata]()
+ reusablePVCs: mutable.Buffer[PersistentVolumeClaim]): Seq[HasMetadata] =
{
+ val replacedResources = mutable.Set[HasMetadata]()
resources.foreach {
case pvc: PersistentVolumeClaim =>
// Find one with the same storage class and size.
@@ -407,7 +407,7 @@ private[spark] class ExecutorPodsAllocator(
}
if (volume.nonEmpty) {
val matchedPVC = reusablePVCs.remove(index)
- replacedResources.append(pvc)
+ replacedResources.add(pvc)
logInfo(s"Reuse PersistentVolumeClaim
${matchedPVC.getMetadata.getName}")
volume.get.getPersistentVolumeClaim.setClaimName(matchedPVC.getMetadata.getName)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]