This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new c1b660e  [SPARK-33096][K8S] Use LinkedHashMap instead of Map for 
newlyCreatedExecutors
c1b660e is described below

commit c1b660efa31fdb79df058c847244791c9bec90ff
Author: Dongjoon Hyun <dh...@apple.com>
AuthorDate: Thu Oct 8 11:50:53 2020 -0700

    [SPARK-33096][K8S] Use LinkedHashMap instead of Map for 
newlyCreatedExecutors
    
    ### What changes were proposed in this pull request?
    
    This PR aims to use `LinkedHashMap` instead of `Map` for 
`newlyCreatedExecutors`.
    
    ### Why are the changes needed?
    
    This makes log messages (INFO/DEBUG) more readable. This is helpful when 
`spark.kubernetes.allocation.batch.size` is large and especially when K8s 
dynamic allocation is used.
    
    **BEFORE**
    ```
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 8 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 2 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 5 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 4 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 7 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 10 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 9 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 3 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 DEBUG ExecutorPodsAllocator: Executor with id 6 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:24:21 INFO ExecutorPodsAllocator: Deleting 9 excess pod 
requests (5,10,6,9,2,7,3,8,4).
    ```
    
    **AFTER**
    ```
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 2 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 3 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 4 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 5 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 6 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 7 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 8 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 9 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 DEBUG ExecutorPodsAllocator: Executor with id 10 was not 
found in the Kubernetes cluster since it was created 0 milliseconds ago.
    20/10/08 10:25:17 INFO ExecutorPodsAllocator: Deleting 9 excess pod 
requests (2,3,4,5,6,7,8,9,10).
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Pass the CI or `build/sbt -Pkubernetes "kubernetes/test"`
    
    Closes #29979 from dongjoon-hyun/SPARK-K8S-LOG.
    
    Authored-by: Dongjoon Hyun <dh...@apple.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
    (cherry picked from commit 4987db8c88b49a0c0d8503b6291455e92e114efa)
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 b394f35..66cba55 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
@@ -64,7 +64,7 @@ private[spark] class ExecutorPodsAllocator(
 
   // Executor IDs that have been requested from Kubernetes but have not been 
detected in any
   // snapshot yet. Mapped to the timestamp when they were created.
-  private val newlyCreatedExecutors = mutable.Map.empty[Long, Long]
+  private val newlyCreatedExecutors = mutable.LinkedHashMap.empty[Long, Long]
 
   private val dynamicAllocationEnabled = Utils.isDynamicAllocationEnabled(conf)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to