【问题标题】:how to pass arguments in EMR job to use in bootstrap script如何在 EMR 作业中传递参数以在引导脚本中使用
【发布时间】:2013-07-16 23:19:24
【问题描述】:

我有一个与我的 EMR 作业一起运行的引导脚本。 我需要向这个脚本传递一个参数,这样我就可以为不同的环境配置一个路径 我脚本中的以下行需要使用它 路径=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));

【问题讨论】:

    标签: c# amazon bootstrapping emr


    【解决方案1】:

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

     ScriptBootstrapActionConfig bootstrapActionScript = new ScriptBootstrapActionConfig()
                    .WithPath(configBootStrapScriptLocation)
                    .WithArgs(List<String> args);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-08
      • 2020-09-04
      • 2021-11-11
      • 2014-08-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-19
      相关资源
      最近更新 更多