File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed 
main/scala/org/apache/spark 
test/scala/org/apache/spark/scheduler Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ class SparkStatusTracker private[spark] (sc: SparkContext) {
112112   */  
113113  def  getExecutorInfos :  Array [SparkExecutorInfo ] =  {
114114    val  executorIdToRunningTasks :  Map [String , Int ] = 
115-       sc.taskScheduler.asInstanceOf [TaskSchedulerImpl ].runningTasksByExecutors() 
115+       sc.taskScheduler.asInstanceOf [TaskSchedulerImpl ].runningTasksByExecutors
116116
117117    sc.getExecutorStorageStatus.map { status => 
118118      val  bmId  =  status.blockManagerId
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ private[spark] class TaskSchedulerImpl(
9696  //  IDs of the tasks running on each executor
9797  private  val  executorIdToRunningTaskIds  =  new  HashMap [String , HashSet [Long ]]
9898
99-   def  runningTasksByExecutors () :  Map [String , Int ] =  {
99+   def  runningTasksByExecutors :  Map [String , Int ] =   synchronized  {
100100    executorIdToRunningTaskIds.toMap.mapValues(_.size)
101101  }
102102
Original file line number Diff line number Diff line change @@ -678,7 +678,7 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
678678    //  Check that state associated with the lost task attempt is cleaned up:
679679    assert(taskScheduler.taskIdToExecutorId.isEmpty)
680680    assert(taskScheduler.taskIdToTaskSetManager.isEmpty)
681-     assert(taskScheduler.runningTasksByExecutors() .get(" executor0"  ).isEmpty)
681+     assert(taskScheduler.runningTasksByExecutors.get(" executor0"  ).isEmpty)
682682  }
683683
684684  test(" if a task finishes with TaskState.LOST its executor is marked as dead"  ) {
@@ -709,7 +709,7 @@ class TaskSchedulerImplSuite extends SparkFunSuite with LocalSparkContext with B
709709    //  Check that state associated with the lost task attempt is cleaned up:
710710    assert(taskScheduler.taskIdToExecutorId.isEmpty)
711711    assert(taskScheduler.taskIdToTaskSetManager.isEmpty)
712-     assert(taskScheduler.runningTasksByExecutors() .get(" executor0"  ).isEmpty)
712+     assert(taskScheduler.runningTasksByExecutors.get(" executor0"  ).isEmpty)
713713
714714    //  Check that the executor has been marked as dead
715715    assert(! taskScheduler.isExecutorAlive(" executor0"  ))
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments