一、在验证是否活跃提交模式里面
public boolean isActive(CommandLine commandLine) {
//命令行是否有 yarn-cluster final String jobManagerOption = commandLine.getOptionValue(addressOption.getOpt(), null); final boolean yarnJobManager = ID.equals(jobManagerOption);
//命令行里面是否有appid,配置里面是否有appid application_1623987801507_0002 final boolean hasYarnAppId = commandLine.hasOption(applicationId.getOpt()) || configuration.getOptional(YarnConfigOptions.APPLICATION_ID).isPresent();
//配置里面是否有执行器是基于yarn final boolean hasYarnExecutor = YarnSessionClusterExecutor.NAME.equalsIgnoreCase(configuration.get(DeploymentOptions.TARGET)) || YarnJobClusterExecutor.NAME.equalsIgnoreCase(configuration.get(DeploymentOptions.TARGET)); return hasYarnExecutor || yarnJobManager || hasYarnAppId; }
YarnSessionClusterExecutor.NAME里面有这三个
PER_JOB("yarn-per-job"), SESSION("yarn-session"), APPLICATION("yarn-application");
这三个条件有一个,走yarn模式提交