Github user kayousterhout commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4147#discussion_r24057066
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/local/LocalBackend.scala ---
    @@ -74,10 +77,20 @@ private[spark] class LocalActor(
     
       def reviveOffers() {
         val offers = Seq(new WorkerOffer(localExecutorId, 
localExecutorHostname, freeCores))
    -    for (task <- scheduler.resourceOffers(offers).flatten) {
    -      freeCores -= scheduler.CPUS_PER_TASK
    -      executor.launchTask(executorBackend, taskId = task.taskId, 
attemptNumber = task.attemptNumber,
    -        task.name, task.serializedTask)
    +    val tasks = scheduler.resourceOffers(offers).flatten
    +    if (tasks.nonEmpty) {
    --- End diff --
    
    As long as you have to fix the comma issue, can you eliminate this "if" 
(just have the for-loop), and then on line 88, do "if (tasks.empty && 
scheduler.activeTaskSets.nonEmpty)"? I think that would make this slightly more 
resilient to being broken later on if someone doesn't notice the subtlety of 
the two if-statements here


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to