Driver generate jobs and launch task
1. Driver将按照DStream的compute方法生成RDD的依赖列表
2. 按照RDD的关系生成stage的列表,stage分为两种:finalStage和shuffledStage .
1)每个ShuffledRDD 都会产生一个shuffledStage,shuffledstage用来将shuffledRDD的prev RDD计算的结果按照patition写入到每个bucket中去,这个过程叫做shuff writer。ShuffledRDD 在computer的时候会按照patition ID 和shuff ID 去每个bucket拿数据。
2)finalStage调用每个RDD的computor函数就算结果,computor的函数参数是前一个RDD的iterator以及context,computor的返回值是经过转换过的iterator以及context。用的是装饰者模式。
3. Deriver按照每个stage生成一个taskset,然后以来SchedulableBuilder确定taskset提交的顺序,每个task依赖于RDD的getPreferredLocations来确定提交到那个Excutor
Driver will depend on the computor function of DStream to generate RDD.
bellow picture show the workflow of launch tasks
评论