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

    https://github.com/apache/spark/pull/15505#discussion_r103556523
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
 ---
    @@ -621,6 +615,80 @@ class CoarseGrainedSchedulerBackend(scheduler: 
TaskSchedulerImpl, val rpcEnv: Rp
       }
     }
     
    -private[spark] object CoarseGrainedSchedulerBackend {
    +private[spark] object CoarseGrainedSchedulerBackend extends Logging {
       val ENDPOINT_NAME = "CoarseGrainedScheduler"
    +
    +  // abort TaskSetManager without exception
    +  private def abortTaskSetManager(
    +      scheduler: TaskSchedulerImpl,
    +      taskId: Long,
    +      msg: => String,
    +      exception: Option[Throwable] = None): Unit = scheduler.synchronized {
    +    scheduler.taskIdToTaskSetManager.get(taskId).foreach { taskSetMgr =>
    +      try {
    +        taskSetMgr.abort(msg, exception)
    +      } catch {
    +        case e: Exception => logError("Exception in error callback", e)
    +      }
    +    }
    +  }
    +
    +  private def isZombieTaskSetManager(
    +    scheduler: TaskSchedulerImpl,
    +    taskId: Long): Unit = scheduler.synchronized {
    +    !scheduler.taskIdToTaskSetManager.get(taskId).exists(_.isZombie)
    +  }
    +
    +  private def getTaskSetManager(
    +    scheduler: TaskSchedulerImpl,
    +    taskId: Long): Option[TaskSetManager] = scheduler.synchronized {
    +    scheduler.taskIdToTaskSetManager.get(taskId)
    +  }
    +
    +  private[scheduler] def prepareSerializedTask(
    +    scheduler: TaskSchedulerImpl,
    +    task: TaskDescription,
    +    abortSet: HashSet[TaskSetManager],
    +    maxRpcMessageSize: Long): ByteBuffer = {
    +    var serializedTask: ByteBuffer = null
    +    if (abortSet.isEmpty || !getTaskSetManager(scheduler, 
task.taskId).exists(_.isZombie)) {
    +      try {
    +        serializedTask = TaskDescription.encode(task)
    +      } catch {
    +        case NonFatal(e) =>
    +          abortTaskSetManager(scheduler, task.taskId,
    +            s"Failed to serialize task ${task.taskId}, not attempting to 
retry it.", Some(e))
    +          scheduler.taskIdToTaskSetManager.get(task.taskId).foreach(t => 
abortSet.add(t))
    +      }
    +    }
    +
    +    if (serializedTask != null && serializedTask.limit >= 
maxRpcMessageSize) {
    +      val msg = "Serialized task %s:%d was %d bytes, which exceeds max 
allowed: " +
    +        "spark.rpc.message.maxSize (%d bytes). Consider increasing " +
    +        "spark.rpc.message.maxSize or using broadcast variables for large 
values."
    +      abortTaskSetManager(scheduler, task.taskId,
    +        msg.format(task.taskId, task.index, serializedTask.limit, 
maxRpcMessageSize))
    +      getTaskSetManager(scheduler, task.taskId).foreach(t => 
abortSet.add(t))
    +      serializedTask = null
    +    } else if (serializedTask != null) {
    +      emittedTaskSizeWarning(scheduler, serializedTask, task.taskId)
    +    }
    +    serializedTask
    +  }
    +
    +  private def emittedTaskSizeWarning(
    --- End diff --
    
    rename to `maybeEmitTaskSizeWarning`


---
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