0

次のようなコマンドで行うように、Java APIでジョブフローを「キープアライブ」に設定するにはどうすればよいですか。

elastic-mapreduce --create --alive ...

withKeepJobFlowAlivewhenNoSteps(true) を追加しようとしましたが、これでもステップが失敗したときにジョブフローがシャットダウンされます (たとえば、悪い jar を送信した場合)。

4

1 に答える 1

1

ステップが失敗したときに何をすべきかをAPIに知らせるように設定する必要がありwithActionOnFailure、これはステップごとに設定する必要があります。

あなたはあなたのために持っている必要がありwithActionOnFailure("TERMINATE_JOB_FLOW")ますStepConfig。に変更しますwithActionOnFailure("CANCEL_AND_WAIT")

以下は、ここから取得した Java API を使用してクラスターを起動するための完全なコードで、必要なものを置き換えただけです。

AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
   AmazonElasticMapReduceClient emr = new AmazonElasticMapReduceClient(credentials);

   StepFactory stepFactory = new StepFactory();

   StepConfig enabledebugging = new StepConfig()
       .withName("Enable debugging")
       .withActionOnFailure("CANCEL_AND_WAIT") //here is the change
       .withHadoopJarStep(stepFactory.newEnabledebuggingStep());

   StepConfig installHive = new StepConfig()
       .withName("Install Hive")
       .withActionOnFailure("CANCEL_AND_WAIT") //here is the change
       .withHadoopJarStep(stepFactory.newInstallHiveStep());

   RunJobFlowRequest request = new RunJobFlowRequest()
       .withName("Hive Interactive")
       .withSteps(enabledebugging, installHive)
       .withLogUri("s3://myawsbucket/")
       .withInstances(new JobFlowInstancesConfig()
           .withEc2KeyName("keypair")
           .withHadoopVersion("0.20")
           .withInstanceCount(5)
           .withKeepJobFlowAliveWhenNoSteps(true)
           .withMasterInstanceType("m1.small")
           .withSlaveInstanceType("m1.small"));

   RunJobFlowResult result = emr.runJobFlow(request);
于 2013-08-20T18:16:02.967 に答える