Flink1.10基于工厂模式的任务提交与SPI机制

本文介绍了Flink1.10中任务执行的模式,包括local、standalone、per-job、yarn-session和新增的k8s模式。任务提交借助工厂设计模式,通过PipelineExecutorFactory和PipelineExecutor接口实现。PipelineExecutorServiceLoader使用Java的SPI机制,从META-INF.services加载并选择合适的PipelineExecutorFactory,从而创建对应的PipelineExecutor,如LocalExecutor、RemoteExecutor等。
摘要由CSDN通过智能技术生成

Flink任务执行模式包含了yarn-session、standalone、per-job、local, 在1.10中又增加k8s的执行模式,那么在任务提交过程中如何根据不同的执行模式进行任务提交呢?主要通过两个接口来实现:PipelineExecutorFactory 与 PipelineExecutor。PipelineExecutorFactory用于在不同模式下创建不同的PipelineExecutor, 用于提交任务,PipelineExecutorFactory表示的一个创建执行器工厂接口,PipelineExecutor 表示一个执行器接口,正如你所想这里使用的就是经典的工厂设计模式,在任务提交过程中会根据不同的提交模式, 使用不同的PipelineExecutorFactory创建不同的PipelineExecutor。

public interface PipelineExecutorFactory {
   /**
    * Returns the name of the executor that this factory creates.
    */
   String getName();
   /**
      根据configuration判断是否满足当前的factory
    */
   boolean isCompatibleWith(final Configuration configuration);
   /**
    * 获取对应模式下的executor
    */
   PipelineExecutor getExecutor(final Configuration configuration);
}

PipelineExecutorFactory几个实现分别为:

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值