我有一个使用我的EMR作业运行的引导脚本。 我需要将参数传递给此脚本,以便为不同的环境配置路径 我的脚本中的以下行需要使用它 路径= OVA / {EnvironmentName} /脚本/ 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));
答案 0 :(得分:1)
你可以使用withArgs()
ScriptBootstrapActionConfig
,用Java做你可以做的如下,我相信C#有类似的方法:
ScriptBootstrapActionConfig bootstrapActionScript = new ScriptBootstrapActionConfig()
.WithPath(configBootStrapScriptLocation)
.WithArgs(List<String> args);