Submit spark job to AWS EMR with java code and wait for the execution and get final status -


i trying submit spark job aws emr via aws emr sdk apis. want process submit job , wait job complete/fail , respective status.

code:

    awscredentials credentials = new basicawscredentials(accesskey, secretkey); amazonelasticmapreduce emr =         amazonelasticmapreduceclientbuilder                 .standard()                 .withcredentials(new awsstaticcredentialsprovider(credentials))                 .build();  hadoopjarstepconfig sparkstepconf =         new hadoopjarstepconfig()                 .withjar("command-runner.jar")                 .withargs("spark-submit")                 .withargs("--master", "yarn")                 .withargs(sparkjarpath)                 .withargs(args);  stepconfig sparkstep =         new stepconfig().withname("spark step").withactiononfailure(actiononfailure.continue).withhadoopjarstep(                 sparkstepconf);  addjobflowstepsrequest req =         new addjobflowstepsrequest().withjobflowid(clusterid).withsteps(collections.singletonlist(sparkstep)); emr.addjobflowsteps(req); 

couldn't find fetch status of submitted jobs

here example (please check emptiness in areas of code):

liststepsresult stepsresult = emr.liststeps(new liststepsrequest().withclusterid(clusterid).withstepids(req.getstepids())); list<stepsummary> stepslist = stepsresult.getsteps(); stepsummary stepsummary = stepslist.get(0); stepstatus stepsummarystatus = stepsummary.getstatus(); string stepstatus = stepsummarystatus.getstate(); stepexecutionstate stepstate = stepexecutionstate.valueof(stepstatus); 

stepstate have want.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -