Flink-yarn模块加载外部文件的问题

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Flink-yarn模块加载外部文件的问题

zhou chao
hi all, 最近在1.11上使用io.extra-file加载外部http文件出现一点小问题
由于http的文件在FileSystem.getFileStatus去拿状态时会走HttpFileSystem的类的getFileStatus方法,该方法返回的FileStatus中length为-1。
在client端校验通过后,在decodeYarnLocalResourceDescriptor的时候会碰到问题。
异常如下:
2020-12-04 17:01:28.955 ERROR org.apache.flink.yarn.YarnResourceManager - Could not start TaskManager in container containerXXXXXX.
org.apache.flink.util.FlinkException: Error to parse YarnLocalResourceDescriptor from YarnLocalResourceDescriptor{key=XXXXX.jar, path=https://XXXXXXX.jar, size=-1, modificationTime=0, visibility=APPLICATION}
    at org.apache.flink.yarn.YarnLocalResourceDescriptor.fromString(YarnLocalResourceDescriptor.java:99)
    at org.apache.flink.yarn.Utils.decodeYarnLocalResourceDescriptorListFromString(Utils.java:721)
    at org.apache.flink.yarn.Utils.createTaskExecutorContext(Utils.java:626)
    at org.apache.flink.yarn.YarnResourceManager.getOrCreateContainerLaunchContext(YarnResourceManager.java:746)
    at org.apache.flink.yarn.YarnResourceManager.createTaskExecutorLaunchContext(YarnResourceManager.java:726)
    at org.apache.flink.yarn.YarnResourceManager.startTaskExecutorInContainer(YarnResourceManager.java:500)
    at org.apache.flink.yarn.YarnResourceManager.onContainersOfResourceAllocated(YarnResourceManager.java:455)
    at org.apache.flink.yarn.YarnResourceManager.lambda$onContainersAllocated$1(YarnResourceManager.java:415)
    。。。。。
因为正则匹配的size只能匹配数字

private static final Pattern LOCAL_RESOURCE_DESC_FORMAT = Pattern.compile("YarnLocalResourceDescriptor\\{" +
   "key=(\\S+), path=(\\S+), size=([\\d]+), modificationTime=([\\d]+), visibility=(\\S+), type=(\\S+)}");

负号不能被匹配上,想要实现加载http的文件需要mock一个length大于-1的FileStatus。
想问下各位大佬,看到有加载remote文件的功能,这块功能是不是给远程hdfs上文件用的,并没有考虑到http文件呢?
Reply | Threaded
Open this post in threaded view
|

Re: Flink-yarn模块加载外部文件的问题

Xintong Song
Hi,

你指的是 `yarn.provided.lib.dirs` 吗?
这个地方设计的时候确实是只考虑到了 hdfs,没有考虑 http 文件。

我刚刚也和熟悉 hadoop 的朋友确认了一下,从 yarn 的层面上应该也是支持 http 文件的,所以 flink 最好也是能支持 http 文件。
由于整个 feature 在设计的时候都没有考虑到 http 文件的问题,不确定修复了正则匹配的问题后是否还会有其他问题。
我开了 FLINK-20505 来跟踪 provided lib 支持 http 文件的整体进度。

https://issues.apache.org/jira/browse/FLINK-20505

Thank you~

Xintong Song



On Mon, Dec 7, 2020 at 10:03 AM zhou chao <[hidden email]> wrote:

> hi all, 最近在1.11上使用io.extra-file加载外部http文件出现一点小问题
>
> 由于http的文件在FileSystem.getFileStatus去拿状态时会走HttpFileSystem的类的getFileStatus方法,该方法返回的FileStatus中length为-1。
> 在client端校验通过后,在decodeYarnLocalResourceDescriptor的时候会碰到问题。
> 异常如下:
> 2020-12-04 17:01:28.955 ERROR org.apache.flink.yarn.YarnResourceManager -
> Could not start TaskManager in container containerXXXXXX.
> org.apache.flink.util.FlinkException: Error to parse
> YarnLocalResourceDescriptor from YarnLocalResourceDescriptor{key=XXXXX.jar,
> path=https://XXXXXXX.jar, size=-1, modificationTime=0,
> visibility=APPLICATION}
>     at
> org.apache.flink.yarn.YarnLocalResourceDescriptor.fromString(YarnLocalResourceDescriptor.java:99)
>     at
> org.apache.flink.yarn.Utils.decodeYarnLocalResourceDescriptorListFromString(Utils.java:721)
>     at
> org.apache.flink.yarn.Utils.createTaskExecutorContext(Utils.java:626)
>     at
> org.apache.flink.yarn.YarnResourceManager.getOrCreateContainerLaunchContext(YarnResourceManager.java:746)
>     at
> org.apache.flink.yarn.YarnResourceManager.createTaskExecutorLaunchContext(YarnResourceManager.java:726)
>     at
> org.apache.flink.yarn.YarnResourceManager.startTaskExecutorInContainer(YarnResourceManager.java:500)
>     at
> org.apache.flink.yarn.YarnResourceManager.onContainersOfResourceAllocated(YarnResourceManager.java:455)
>     at
> org.apache.flink.yarn.YarnResourceManager.lambda$onContainersAllocated$1(YarnResourceManager.java:415)
>     。。。。。
> 因为正则匹配的size只能匹配数字
>
> private static final Pattern LOCAL_RESOURCE_DESC_FORMAT =
> Pattern.compile("YarnLocalResourceDescriptor\\{" +
>    "key=(\\S+), path=(\\S+), size=([\\d]+), modificationTime=([\\d]+),
> visibility=(\\S+), type=(\\S+)}");
>
> 负号不能被匹配上,想要实现加载http的文件需要mock一个length大于-1的FileStatus。
> 想问下各位大佬,看到有加载remote文件的功能,这块功能是不是给远程hdfs上文件用的,并没有考虑到http文件呢?
>