Exemple #1
0
        /// <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
            });
        }
 private Amazon.ElasticMapReduce.Model.DescribeJobFlowsResponse CallAWSServiceOperation(IAmazonElasticMapReduce client, Amazon.ElasticMapReduce.Model.DescribeJobFlowsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic MapReduce", "DescribeJobFlows");
     try
     {
         #if DESKTOP
         return(client.DescribeJobFlows(request));
         #elif CORECLR
         return(client.DescribeJobFlowsAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }