第37课 : Task执行内幕与结果处理解密

第37课 :  Task执行内幕与结果处理解密

Task执行及结果处理原理流程图和源码解密:

在Standalone模式中,Driver中的CoarseGrainedSchedulerBackend给CoarseGrainedExecutorBackend发送launchTasks消息,CoarseGrainedExecutorBackend收到launchTasks消息以后会调用executor.launchTask。

CoarseGrainedExecutorBackend的receive方法如下,模式匹配收到LaunchTask消息:

1.         override def receive:PartialFunction[Any, Unit] = {

2.         ……

3.          case LaunchTask(data) =>

4.               if (executor == null) {

5.                 exitExecutor(1, "ReceivedLaunchTask command but executor was null")

6.               } else {

7.                 val taskDesc =ser.deserialize[TaskDescription](data.value)

8.                 logInfo("Got assigned task "+ taskDesc.taskId)

9.                 executor.launchTask(this, taskId =taskDesc.taskId, attemptNumber = taskDesc.attemptNumber,

10.                taskDesc.name,taskDesc.serializedTask)

11.            }

 

(1)LaunchTask判断ex

你可能感兴趣的:(SparkInBeiJing)