你好,-m 配合 -yxx 的参数是早期 Flink on YARN 的 cli 参数用法,后来社区开始推进一套新的统一的 cli 命令,使用 -t 
指定部署形式,并将原先的 cli options 统一动态参数化,比如原先的 -yxx 命令都能从 
https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/deployment/config/#yarn
 找到替代的动态参数。
Configuration | Apache 
Flink<https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/deployment/config/#yarn>
Key Default Type Description; restart-strategy.fixed-delay.attempts: 1: 
Integer: The number of times that Flink retries the execution before the job is 
declared as failed if restart-strategy has been set to fixed-delay.: 
restart-strategy.fixed-delay.delay
nightlies.apache.org


Best,
Zhanghao Chen
________________________________
From: gangzi <1139872...@qq.com.INVALID>
Sent: Monday, April 11, 2022 19:55
To: user-zh <user-zh@flink.apache.org>
Subject: flink命令行参数不生效问题

我用命令提交作业:flink run -t yarn-per-job -ynm SocketWordCount -yqu root.root&nbsp; -d 
-n SocketWindowWordCount.jar --hostname 10.199.0.97 --port 9878。结果作业提交成功之后发现 
-ynm和-yqu不生效。后来通过查看源码发现是因为如果指定了 
-t,那么-y开头的所有参数都不生效了,因为-y系列参数是在FlinkYarnSessionCli中解析的,而源码中:public 
CustomCommandLine validateAndGetActiveCommandLine(CommandLine commandLine) {
&nbsp; &nbsp; LOG.debug("Custom commandlines: {}", customCommandLines);
&nbsp; &nbsp; for (CustomCommandLine cli : customCommandLines) {
&nbsp; &nbsp; &nbsp; &nbsp; LOG.debug(
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "Checking custom 
commandline {}, isActive: {}", cli, cli.isActive(commandLine));
&nbsp; &nbsp; &nbsp; &nbsp; if (cli.isActive(commandLine)) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return cli;
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }
&nbsp; &nbsp; throw new IllegalStateException("No valid command-line found.");
}
这段代码返回的是GenericCLI。导致后面的:
final Configuration effectiveConfiguration =
&nbsp; &nbsp; &nbsp; &nbsp; getEffectiveConfiguration(activeCommandLine, 
commandLine, programOptions, jobJars);
这行代码返回的命令行参数配置只包含了GenericCli中定义的参数。想请教一下,-t和-m设置参数时有啥区别?如何解决上述参数不生效的问题?这是一个bug么?

回复