提交任务
spark 工作节点 包含 master node, workNode ;
通过 RpcEndpoint 实现节点间的通信, RpcEndpoint::receive 是 处理消息的入口函数;
Executor 是work node 的处理 task的 线程池;
1 SparkSubmit 通过 RestSubmissionClient 向master 提交spark任务
2 master::receive 处理消息, 接受到 RegisterApplication 消息, 调度起集群的spark 处理任务
3 在 work node 启动driver 驱动线程, 在 work node 启动 executor线程。
4 CoarseGrainedSchedulerBackend 是驱动启动的 main 入口类 CoarseGrainedExecutorBackend 是各个 处理节点的 入库类
5 在 driver 线程中, DAGScheduler 将一个spark 任务被分为 多个stage,并分发给各个work node LaunchTask 消息, work node 反序列化 参数得到 TaskDescription, 就是 处理的task 任务的信息
private[spark] class TaskDescription(
val taskId: Long,
val attemptNumber: Int,
val executorId: String,
val name: String,
val index: Int, // Index within this task’s TaskSet
val partitionId: Int,
val addedFiles: Map[String, Long],
val addedJars: Map[String, Long],
val properties: Properties,
val resources: immutable.Map[String, ResourceInformation],
val serializedTask: ByteBuffer)
其中 serializedTask 再被反序列化为 rdd 和 func ,就是 处理的数据,和spark 动作算子, 最后将结果返回给 driver,作为下一个stage 的处理的数据源。