/// <summary>
        /// <para> AddJobFlowSteps adds new steps to a running job flow. A maximum
        /// of 256 steps are allowed in each job flow. </para> <para> A step
        /// specifies the location of a JAR file stored either on the master node
        /// of the job flow or in Amazon S3. Each step is performed by the main
        /// function of the main class of the JAR file. The main class can be
        /// specified either in the manifest of the JAR or by using the
        /// MainFunction parameter of the step. </para> <para> Elastic MapReduce
        /// executes each step in the order listed. For a step to be considered
        /// complete, the main function must exit with a zero exit code and all
        /// Hadoop jobs started while the step was running must have completed and
        /// run successfully. </para> <para> You can only add steps to a job flow
        /// that is in one of the following states: STARTING, BOOTSTAPPING,
        /// RUNNING, or WAITING.</para>
        /// </summary>
        ///
        /// <param name="addJobFlowStepsRequest">Container for the necessary
        ///           parameters to execute the AddJobFlowSteps service method on
        ///           AmazonElasticMapReduce.</param>
        ///
        /// <exception cref="InternalServerErrorException"/>
        public AddJobFlowStepsResponse AddJobFlowSteps(AddJobFlowStepsRequest addJobFlowStepsRequest)
        {
            IRequest <AddJobFlowStepsRequest> request  = new AddJobFlowStepsRequestMarshaller().Marshall(addJobFlowStepsRequest);
            AddJobFlowStepsResponse           response = Invoke <AddJobFlowStepsRequest, AddJobFlowStepsResponse> (request, this.signer, AddJobFlowStepsResponseUnmarshaller.GetInstance());

            return(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Send a request to EMR service to add new step/steps
        /// </summary>
        /// <param name="emrClient">EMR Client to make requests to the Amazon EMR Service</param>
        /// <param name="settings">Settings to replace placeholders</param>
        /// <param name="jobFlowId">Existing jobflow Id, can be null for the new job.</param>
        /// <returns>JobFlow Id, if request failed -> returns null</returns>
        public override async Task <string> SendAsync(IAmazonElasticMapReduce emrClient, IBuilderSettings settings, string jobFlowId)
        {
            AddJobFlowStepsRequestBuilder builder = new AddJobFlowStepsRequestBuilder(settings);
            AddJobFlowStepsRequest        request = builder.Build(jobFlowId, this.steps);

            AddJobFlowStepsResponse response = await emrClient.AddJobFlowStepsAsync(request);

            return(this.IsOk(response) ? jobFlowId : null);
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            AddJobFlowStepsResponse response = new AddJobFlowStepsResponse();

            context.Read();

            UnmarshallResult(context, response);
            return(response);
        }
Exemplo n.º 4
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            AddJobFlowStepsResponse response = new AddJobFlowStepsResponse();

            while (context.Read())
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
            }


            return(response);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            AddJobFlowStepsResponse response = new AddJobFlowStepsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("StepIds", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    response.StepIds = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        private static void UnmarshallResult(JsonUnmarshallerContext context, AddJobFlowStepsResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("StepIds", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        response.StepIds = null;
                        continue;
                    }
                    response.StepIds = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.StepIds.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }