internal DescribeJobFlowsResponse DescribeJobFlows(DescribeJobFlowsRequest request)
        {
            var marshaller   = new DescribeJobFlowsRequestMarshaller();
            var unmarshaller = DescribeJobFlowsResponseUnmarshaller.Instance;

            return(Invoke <DescribeJobFlowsRequest, DescribeJobFlowsResponse>(request, marshaller, unmarshaller));
        }
        private static IDictionary <string, string> ConvertDescribeJobFlows(DescribeJobFlowsRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "DescribeJobFlows";
            if (request.IsSetCreatedAfter())
            {
                dictionary["CreatedAfter"] = request.CreatedAfter;
            }
            if (request.IsSetCreatedBefore())
            {
                dictionary["CreatedBefore"] = request.CreatedBefore;
            }
            List <string> jobFlowIds = request.JobFlowIds;
            int           num        = 1;

            foreach (string str in jobFlowIds)
            {
                dictionary["JobFlowIds" + ".member." + num] = str;
                num++;
            }
            List <string> jobFlowStates = request.JobFlowStates;
            int           num2          = 1;

            foreach (string str2 in jobFlowStates)
            {
                dictionary["JobFlowStates" + ".member." + num2] = str2;
                num2++;
            }
            return(dictionary);
        }
示例#3
0
        /**
         * Convert DescribeJobFlowsRequest to name value pairs
         */
        private static IDictionary <string, string> ConvertDescribeJobFlows(DescribeJobFlowsRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "DescribeJobFlows";
            if (request.IsSetCreatedAfter())
            {
                parameters["CreatedAfter"] = request.CreatedAfter;
            }
            if (request.IsSetCreatedBefore())
            {
                parameters["CreatedBefore"] = request.CreatedBefore;
            }
            List <string> describeJobFlowsRequestJobFlowIdsList      = request.JobFlowIds;
            int           describeJobFlowsRequestJobFlowIdsListIndex = 1;

            foreach (string describeJobFlowsRequestJobFlowIds in describeJobFlowsRequestJobFlowIdsList)
            {
                parameters[String.Concat("JobFlowIds", ".member.", describeJobFlowsRequestJobFlowIdsListIndex)] = describeJobFlowsRequestJobFlowIds;
                describeJobFlowsRequestJobFlowIdsListIndex++;
            }
            List <string> describeJobFlowsRequestJobFlowStatesList      = request.JobFlowStates;
            int           describeJobFlowsRequestJobFlowStatesListIndex = 1;

            foreach (string describeJobFlowsRequestJobFlowStates in describeJobFlowsRequestJobFlowStatesList)
            {
                parameters[String.Concat("JobFlowStates", ".member.", describeJobFlowsRequestJobFlowStatesListIndex)] = describeJobFlowsRequestJobFlowStates;
                describeJobFlowsRequestJobFlowStatesListIndex++;
            }

            return(parameters);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeJobFlows operation.
        /// <seealso cref="Amazon.ElasticMapReduce.IAmazonElasticMapReduce"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DescribeJobFlows operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <DescribeJobFlowsResponse> DescribeJobFlowsAsync(DescribeJobFlowsRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DescribeJobFlowsRequestMarshaller();
            var unmarshaller = DescribeJobFlowsResponseUnmarshaller.Instance;

            return(Invoke <IRequest, DescribeJobFlowsRequest, DescribeJobFlowsResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
示例#5
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
            });
        }
        /// <summary>
        /// <para> DescribeJobFlows returns a list of job flows that match all of
        /// the supplied parameters. The parameters can include a list of job flow
        /// IDs, job flow states, and restrictions on job flow creation date and
        /// time.</para> <para> Regardless of supplied parameters, only job flows
        /// created within the last two months are returned.</para> <para> If no
        /// parameters are supplied, then job flows matching either of the
        /// following criteria are returned:</para>
        /// <ul>
        /// <li>Job flows created and completed in the last two weeks</li>
        /// <li> Job flows created within the last two months that are in one of
        /// the following states: <c>RUNNING</c> ,
        ///
        /// <c>WAITING</c> ,
        ///
        /// <c>SHUTTING_DOWN</c> ,
        ///
        /// <c>STARTING</c> </li>
        ///
        /// </ul>
        /// <para> Amazon Elastic MapReduce can return a maximum of 512 job flow
        /// descriptions. </para>
        /// </summary>
        ///
        /// <param name="describeJobFlowsRequest">Container for the necessary
        ///           parameters to execute the DescribeJobFlows service method on
        ///           AmazonElasticMapReduce.</param>
        ///
        /// <returns>The response from the DescribeJobFlows service method, as
        ///         returned by AmazonElasticMapReduce.</returns>
        ///
        /// <exception cref="InternalServerErrorException"/>
        public DescribeJobFlowsResponse DescribeJobFlows(DescribeJobFlowsRequest describeJobFlowsRequest)
        {
            IRequest <DescribeJobFlowsRequest> request  = new DescribeJobFlowsRequestMarshaller().Marshall(describeJobFlowsRequest);
            DescribeJobFlowsResponse           response = Invoke <DescribeJobFlowsRequest, DescribeJobFlowsResponse> (request, this.signer, DescribeJobFlowsResponseUnmarshaller.GetInstance());

            return(response);
        }
        IAsyncResult invokeDescribeJobFlows(DescribeJobFlowsRequest describeJobFlowsRequest, AsyncCallback callback, object state, bool synchronized)
        {
            IRequest    irequest     = new DescribeJobFlowsRequestMarshaller().Marshall(describeJobFlowsRequest);
            var         unmarshaller = DescribeJobFlowsResponseUnmarshaller.GetInstance();
            AsyncResult result       = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);

            Invoke(result);
            return(result);
        }
        internal DescribeJobFlowsResponse DescribeJobFlows(DescribeJobFlowsRequest request)
        {
            var task = DescribeJobFlowsAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
示例#9
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonElasticMapReduceConfig config = new AmazonElasticMapReduceConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonElasticMapReduceClient client = new AmazonElasticMapReduceClient(creds, config);

            DescribeJobFlowsResponse resp = new DescribeJobFlowsResponse();
            DescribeJobFlowsRequest  req  = new DescribeJobFlowsRequest
            {
            };

            resp = client.DescribeJobFlows(req);
            CheckError(resp.HttpStatusCode, "200");

            foreach (var obj in resp.JobFlows)
            {
                AddObject(obj);
            }
        }
示例#10
0
 /// <summary>
 /// Describe Job Flows
 /// </summary>
 /// <param name="request">Describe Job Flows  request</param>
 /// <returns>Describe Job Flows  Response from the service</returns>
 public DescribeJobFlowsResponse DescribeJobFlows(DescribeJobFlowsRequest request)
 {
     return(Invoke <DescribeJobFlowsResponse>(ConvertDescribeJobFlows(request)));
 }
 /// <summary>
 /// Initiates the asynchronous execution of the DescribeJobFlows operation.
 /// <seealso cref="Amazon.ElasticMapReduce.AmazonElasticMapReduce.DescribeJobFlows"/>
 /// </summary>
 ///
 /// <param name="describeJobFlowsRequest">Container for the necessary parameters to execute the DescribeJobFlows operation on
 ///          AmazonElasticMapReduce.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 ///
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeJobFlows
 ///         operation.</returns>
 public IAsyncResult BeginDescribeJobFlows(DescribeJobFlowsRequest describeJobFlowsRequest, AsyncCallback callback, object state)
 {
     return(invokeDescribeJobFlows(describeJobFlowsRequest, callback, state, false));
 }
        /// <summary>
        /// <para> DescribeJobFlows returns a list of job flows that match all of the supplied parameters. The parameters can include a list of job flow
        /// IDs, job flow states, and restrictions on job flow creation date and time.</para> <para> Regardless of supplied parameters, only job flows
        /// created within the last two months are returned.</para> <para> If no parameters are supplied, then job flows matching either of the
        /// following criteria are returned:</para>
        /// <ul>
        /// <li>Job flows created and completed in the last two weeks</li>
        /// <li> Job flows created within the last two months that are in one of the following states: <c>RUNNING</c> ,
        /// <c>WAITING</c> ,
        /// <c>SHUTTING_DOWN</c> ,
        ///
        /// <c>STARTING</c> </li>
        ///
        /// </ul>
        /// <para> Amazon Elastic MapReduce can return a maximum of 512 job flow descriptions. </para>
        /// </summary>
        ///
        /// <param name="describeJobFlowsRequest">Container for the necessary parameters to execute the DescribeJobFlows service method on
        ///          AmazonElasticMapReduce.</param>
        ///
        /// <returns>The response from the DescribeJobFlows service method, as returned by AmazonElasticMapReduce.</returns>
        ///
        /// <exception cref="InternalServerErrorException"/>
        public DescribeJobFlowsResponse DescribeJobFlows(DescribeJobFlowsRequest describeJobFlowsRequest)
        {
            IAsyncResult asyncResult = invokeDescribeJobFlows(describeJobFlowsRequest, null, null, true);

            return(EndDescribeJobFlows(asyncResult));
        }