当前位置: 首页 > news >正文

Flink源码之JobMaster启动流程

Flink中Graph转换流程如下:

在这里插入图片描述

Flink Job提交时各种类型Graph转换流程中,JobGraph是Client端形成StreamGraph后经过Operator Chain优化后形成的,然后提交给JobManager的Restserver,最终转发给JobManager的Dispatcher处理。

CompletableFuture<Acknowledge> submitJob(JobGraph jobGraph, @RpcTimeout Time timeout);

本文主要解析从JobGraph转换为ExecutionGraph过程,执行栈如下:

Dispacher::submitJob
Dispacher::internalSubmitJob
Dispacher::persistAndRunJob
Dispacher::runJob
Dispacher::createJobManagerRunner
JobMasterServiceLeadershipRunnerFactory::createJobManagerRunner
JobMasterServiceLeadershipRunner:start
JobMasterServiceLeadershipRunner::grantLeadership
JobMasterServiceLeadershipRunner::startJobMasterServiceProcessAsync
JobMasterServiceLeadershipRunner::verifyJobSchedulingStatusAndCreateJobMasterServiceProcess
JobMasterServiceLeadershipRunner::createNewJobMasterServiceProcess
DefaultJobMasterServiceProcessFactory::create
DefaultJobMasterServiceProcess::new
DefaultJobMasterServiceFactory::createJobMasterService
DefaultJobMasterServiceFactory::internalCreateJobMasterService //创建JobMaster并调用其start
JobMaster::new //调用DefaultSlotPoolServiceSchedulerFactory::createScheduler
DefaultSlotPoolServiceSchedulerFactory::createScheduler //根据调度模式选择调度器
DefaultSchedulerFactory::createInstance //创建SchedulerNG
DefaultScheduler::new //
SchedulerBase::newSchedulerBase::createAndRestoreExecutionGraph DefaultExecutionGraphFactory::createAndRestoreExecutionGraphDefaultExecutionGraphBuilder.buildGraph//在此会将JobGraph转换为ExecutionGraphDefaultExecutionGraph::newDefaultExecutionGraph::attachJobGraph //创建ExecutionJobVertexDefaultExecutionTopology.fromExecutionGraph //创建ExecutionTopologyDefaultExecutionGraph::enableCheckpointing //创建CheckpointCoordinatorCheckpointCoordinator::new   
PipelinedRegionSchedulingStrategy.Factory.createInstance //创建PipelinedRegionSchedulingStrategyJobMaster::start
JobMaster::onStart
JobMaster::startJobExecution
JobMaster::startJobMasterServices //获取RM地址后与RM建立连接
JobMaster::startScheduling
SchedulerBase::startScheduling
DefaultScheduler::startSchedulingInternal
PipelinedRegionSchedulingStrategy::startScheduling
PipelinedRegionSchedulingStrategy::maybeScheduleRegions
DefaultScheduler::allocateSlotsAndDeploy
DefaultScheduler::allocateSlotsSlotSharingExecutionSlotAllocator::allocateSlotsFor //分配Slot
DefaultScheduler::waitForAllSlotsAndDeployDefaultScheduler::assignAllResourcesAndRegisterProducedPartitionsDefaultScheduler::assignResource //为每个Execution分配SlotDefaultScheduler::registerProducedPartitionsDefaultScheduler::deployAllDefaultScheduler::deployOrHandleErrorDefaultScheduler::deployTaskSafeDefaultExecutionVertexOperations::deployExecutionVertex::deployExecution::deploy //提交任务向TM提交DeploymenTaskManagerGateway.submitTask

在整个提交过程中,首先获取JobMasterService的Leader权限,然后对一个JobGraph生成一个JobMaster,JobMaster先将JobGraph转换为ExecutionGraph,转换核心逻辑在DefaultExecutionGraph::attachJobGraph方法中,最后为每个Execution申请Slot资源,对每个Execution向TM提交TaskDeploymentDescriptor调度执行。

在这里插入图片描述

JobMaster管理整个Job的生命周期,主要有以下功能:

  1. 将JobGraph转换为ExecutionGraph,创建调度器调度执行
  2. 通过心跳保持与ResourceManager的连接,为当前Job向RM申请Slot资源
  3. 接受TaskManager的OfferSlot, 向TM提交task, 主动发送心跳请求保持与执行当前Job的TM的连接
  4. 创建CheckpointCoordinator,触发Checkpoint

Flink中可通过jobmanager.scheduler配置调度类型,默认为NG:

NG:new generation scheduler
Adaptive: adaptive scheduler; supports reactive mode
http://www.lryc.cn/news/120202.html

相关文章:

  • C#,数值计算——抛物线插值与Brent方法(Parabolic Interpolation and Brent‘s Method)的计算方法与源程序
  • 基于Selenium技术方案的爬取界面内容实践
  • 线程记录(1)
  • requests
  • Python 监控 Windows 服务
  • ELK中grok插件、mutate插件、multiline插件、date插件的相关配置
  • 【C#】静默安装、SQL SERVER静默安装等
  • 在vue3中定义组件的5种方式
  • 算法训练营题目,忘了第几天了
  • 蓝桥杯-统计子矩阵
  • 在线预览Word、Excel、PowerPoint等文件
  • 准确预测极端降水,哥伦比亚大学推出升级版神经网络 Org-NN
  • 【数据结构】反转链表、链表的中间节点、链表的回文结构(单链表OJ题)
  • Python爬虫-抓取的目标数据为#x开头,怎么解决?
  • 短视频账号矩阵系统/技术开发搭建私有部署
  • 光致发光二极管光源——荧光效率检测系统
  • 【手撕C语言】多线程
  • Dubbo2-概述
  • 【将回声引入信号中】在语音或音频文件中引入混响或简单回声,以研究回声延迟和回波幅度对生成的回波信号感知的影响(Matlab代码实现)
  • pythonocc进阶学习:投影projection
  • Scractch3.0_Arduino_ESP32_学习随记_显示网络天气(二)
  • Mysql压力测试(sysbench)
  • TBDS MPP参数列表
  • C# OpenCvSharp 读取rtsp流
  • 每日后端面试5题 第七天
  • 计算机视觉的应用10-图片中的表格结构识别与提取实战
  • P4178 Tree (点分治)
  • Kubernetes 二进制搭建
  • QT QtXlsx安装使用
  • Java医院信息化HIS管理系统源码