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

Flink on yarn 加载失败plugins失效问题解决

Flink on yarn 加载失败plugins失效问题解决

flink版本:1.13.6

1. 问题

flink 任务运行在yarn集群,plugins加载失效,导致通过扩展资源获取任务参数失效

2. 问题定位

  1. yarn容器的jar包及插件信息,jar包是正常上传
    在这里插入图片描述

  2. 源码定位
    加载plugins入口,TaskManagerRunner.class
    PluginUtils.createPluginManagerFromRootFolder
    在这里插入图片描述
    源码加载扩展资源参数入口TaskManagerRunner.class
    ExternalResourceUtils.createStaticExternalResourceInfoProviderFromConfig
    在这里插入图片描述
    日志信息
    在这里插入图片描述
    定位PluginConfig源码
    在这里插入图片描述

3. 方案

重写覆盖集群的PluginConfig.java,优先从configurtaion获取

/** Licensed to the Apache Software Foundation (ASF) under one* or more contributor license agreements.  See the NOTICE file* distributed with this work for additional information* regarding copyright ownership.  The ASF licenses this file* to you under the Apache License, Version 2.0 (the* "License"); you may not use this file except in compliance* with the License.  You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package org.apache.flink.core.plugin;import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.apache.flink.configuration.*;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;/** Stores the configuration for plugins mechanism. */
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public class PluginConfig {private static final Logger LOG = LoggerFactory.getLogger(PluginConfig.class);private static final String PUPU_FLINK_PLUGINS_DIR = "flink_plugins_dir";private final Optional<Path> pluginsPath;private final String[] alwaysParentFirstPatterns;private PluginConfig(Optional<Path> pluginsPath, String[] alwaysParentFirstPatterns) {pluginsPath.ifPresent(path -> LOG.info("pluginsPath: {}", path));LOG.info("alwaysParentFirstPatterns: {}", Arrays.stream(alwaysParentFirstPatterns).toArray());this.pluginsPath = pluginsPath;this.alwaysParentFirstPatterns = alwaysParentFirstPatterns;}public Optional<Path> getPluginsPath() {return pluginsPath;}public String[] getAlwaysParentFirstPatterns() {return alwaysParentFirstPatterns;}public static PluginConfig fromConfiguration(Configuration configuration) {return new PluginConfig(getPluginsDir(configuration).map(File::toPath),CoreOptions.getPluginParentFirstLoaderPatterns(configuration));}public static Optional<File> getPluginsDir(Configuration configuration) {String pluginsDir = configuration.get(ConfigOptions.key(PUPU_FLINK_PLUGINS_DIR).stringType().defaultValue(null));if (StringUtils.isBlank(pluginsDir)) {pluginsDir =System.getenv().getOrDefault(ConfigConstants.ENV_FLINK_PLUGINS_DIR,ConfigConstants.DEFAULT_FLINK_PLUGINS_DIRS);}File pluginsDirFile = new File(pluginsDir);if (!pluginsDirFile.isDirectory()) {LOG.warn("The plugins directory [{}] does not exist.", pluginsDirFile);return Optional.empty();}return Optional.of(pluginsDirFile);}}
http://www.lryc.cn/news/213161.html

相关文章:

  • 显卡服务器的特点和优势在哪里
  • c++设计模式二:原型模式
  • 【Qt控件之QMessageBox】详解
  • SSH安全登录远程主机
  • 揭秘!产品经理提升效率的秘密武器:10款AI生成PPT工具
  • Oracle修改带数据的字段类型
  • WebService接口方式和Restful接口这两者有什么区别和相同点
  • jenkins自动化操作步骤(gitblit)
  • centos中mongodb设置服务自启动并 允许远程IP访问
  • 实时定位和配送追踪:开发万岳同城外卖APP的关键技术特性
  • 数据库强化(3.存储过程)
  • 雅思小作文笔记
  • Java List Set Map
  • 【数据结构】数组和字符串(十三):链式字符串的基本操作(串长统计、查找、复制、插入、删除、串拼接)
  • Python3 获取当前服务器公网 IP 地址
  • EAS查前5分钟到现在的组织变动数据
  • uni-app——如何阻止事件冒泡
  • [MySQL]索引
  • 什么是AUTOSAR ComStack,AUTOSAR架构中,CAN通信堆栈CAN Communication Stack介绍
  • 黄金期货与黄金现货的区别
  • 【数据结构】数组和字符串(五):特殊矩阵的压缩存储:稀疏矩阵——压缩稀疏行(CSR)
  • springboot整合postgresql
  • C#__委托delegate
  • Jupyter Notebook的安装方法以及生成ipykernel
  • 测试员如何快速复现bug?一款合适的视频录制软件了解一下
  • 论文-分布式-并发控制-并发控制问题的解决方案
  • 【网络协议】聊聊http协议
  • 图神经网络论文笔记(一)——北邮:基于学习解纠缠因果子结构的图神经网络去偏
  • java初始化list的几种方式
  • Linux:文件操作