/// <summary> /// Send a request to the EMR service to get the latest state of the job /// </summary> /// <param name="emrClient">Instantiated EMR Client to make requests to the Amazon EMR Service</param> /// <param name="jobFlowId">EMR Job flow id</param> /// <returns>Current state of the EMR Job</returns> public async Task <EmrActivityInfo> CheckAsync(IAmazonElasticMapReduce emrClient, String jobFlowId) { //Read job state DescribeJobFlowsRequest request = new DescribeJobFlowsRequest(); request.JobFlowIds = new List <string>() { jobFlowId }; DescribeJobFlowsResponse response = await emrClient.DescribeJobFlowsAsync(request); if (response.HttpStatusCode != HttpStatusCode.OK) { return new EmrActivityInfo() { CurrentState = EmrActivityState.Failed } } ; //Map job state into Completed, Failed or Running JobFlowDetail jobFlowDetail = response.JobFlows[0]; EmrActivityState activityState = EmrJobStateChecker.GetState(jobFlowDetail); return(new EmrActivityInfo() { JobFlowDetail = jobFlowDetail, CurrentState = activityState }); }