1

我有一个与我的 EMR 作业一起运行的引导脚本。我需要向这个脚本传递一个参数,这样我就可以为不同的环境配置一个路径我的脚本中的以下行需要使用它 path=OVA/{EnvironmentName}/Scripts/UniqueUsers

我正在使用 C# 调用流式 EMR 作业。创建作业时如何传递此参数?

  HadoopJarStepConfig config = new StreamingStep()
                .WithInputs(input)
                .WithOutput(output)
                .WithMapper(configMapperLocation)
                .WithReducer(configReducerLocation)
                .ToHadoopJarStepConfig();

            string configName = string.Format("Unique_Users_config_{0}", outputFolder);
            StepConfig uniqueUsersDaily = new StepConfig()
                .WithName(configName)
                .WithActionOnFailure("TERMINATE_JOB_FLOW")
                .WithHadoopJarStep(config);

            ScriptBootstrapActionConfig bootstrapActionScript = new ScriptBootstrapActionConfig()
                .WithPath(configBootStrapScriptLocation);

            BootstrapActionConfig bootstrapAction = new BootstrapActionConfig()
                .WithName("CustomAction")
                .WithScriptBootstrapAction(bootstrapActionScript);

            string jobName = string.Format("Unique_User_DailyJob_{0}", outputFolder);
            RunJobFlowRequest jobRequest = new RunJobFlowRequest()
                .WithName(jobName)
                .WithBootstrapActions(bootstrapAction)
                .WithSteps(uniqueUsersDaily)
                .WithLogUri(configHadoopLogLocation)
                .WithInstances(new JobFlowInstancesConfig()
                                   .WithHadoopVersion(configHadoopVersion)
                                   .WithInstanceCount(2)
                                   .WithKeepJobFlowAliveWhenNoSteps(false)
                                   .WithMasterInstanceType(configMasterInstanceType)
                                   .WithSlaveInstanceType(configSlaveInstanceType));
4

1 回答 1

2

你可以使用withArgs()of ScriptBootstrapActionConfig,在 Java 中你可以这样做,我相信 C# 也有类似的方法:

 ScriptBootstrapActionConfig bootstrapActionScript = new ScriptBootstrapActionConfig()
                .WithPath(configBootStrapScriptLocation)
                .WithArgs(List<String> args);
于 2013-08-07T07:44:35.917 回答