internal AddJobFlowStepsResponse AddJobFlowSteps(AddJobFlowStepsRequest request)
        {
            var marshaller   = new AddJobFlowStepsRequestMarshaller();
            var unmarshaller = AddJobFlowStepsResponseUnmarshaller.Instance;

            return(Invoke <AddJobFlowStepsRequest, AddJobFlowStepsResponse>(request, marshaller, unmarshaller));
        }
        /// <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);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the AddJobFlowSteps operation.
        /// <seealso cref="Amazon.ElasticMapReduce.IAmazonElasticMapReduce"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the AddJobFlowSteps 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 <AddJobFlowStepsResponse> AddJobFlowStepsAsync(AddJobFlowStepsRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new AddJobFlowStepsRequestMarshaller();
            var unmarshaller = AddJobFlowStepsResponseUnmarshaller.Instance;

            return(Invoke <IRequest, AddJobFlowStepsRequest, AddJobFlowStepsResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
        private static IDictionary <string, string> ConvertAddJobFlowSteps(AddJobFlowStepsRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "AddJobFlowSteps";
            if (request.IsSetJobFlowId())
            {
                dictionary["JobFlowId"] = request.JobFlowId;
            }
            List <StepConfig> steps = request.Steps;
            int num = 1;

            foreach (StepConfig config in steps)
            {
                if (config.IsSetName())
                {
                    dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "Name" })] = config.Name;
                }
                if (config.IsSetActionOnFailure())
                {
                    dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "ActionOnFailure" })] = config.ActionOnFailure;
                }
                if (config.IsSetHadoopJarStep())
                {
                    HadoopJarStepConfig hadoopJarStep = config.HadoopJarStep;
                    List <KeyValue>     properties    = hadoopJarStep.Properties;
                    int num2 = 1;
                    foreach (KeyValue value2 in properties)
                    {
                        if (value2.IsSetKey())
                        {
                            dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Properties", ".member.", num2, ".", "Key" })] = value2.Key;
                        }
                        if (value2.IsSetValue())
                        {
                            dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Properties", ".member.", num2, ".", "Value" })] = value2.Value;
                        }
                        num2++;
                    }
                    if (hadoopJarStep.IsSetJar())
                    {
                        dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Jar" })] = hadoopJarStep.Jar;
                    }
                    if (hadoopJarStep.IsSetMainClass())
                    {
                        dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "MainClass" })] = hadoopJarStep.MainClass;
                    }
                    List <string> args = hadoopJarStep.Args;
                    int           num3 = 1;
                    foreach (string str in args)
                    {
                        dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Args", ".member.", num3 })] = str;
                        num3++;
                    }
                }
                num++;
            }
            return(dictionary);
        }
        /// <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);
        }
        IAsyncResult invokeAddJobFlowSteps(AddJobFlowStepsRequest addJobFlowStepsRequest, AsyncCallback callback, object state, bool synchronized)
        {
            IRequest    irequest     = new AddJobFlowStepsRequestMarshaller().Marshall(addJobFlowStepsRequest);
            var         unmarshaller = AddJobFlowStepsResponseUnmarshaller.GetInstance();
            AsyncResult result       = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);

            Invoke(result);
            return(result);
        }
示例#7
0
        public AddJobFlowStepsRequest Build(string jobFlowId, IList <StepBase> stepsList)
        {
            this.result           = new AddJobFlowStepsRequest();
            this.result.JobFlowId = jobFlowId;

            foreach (StepBase step in stepsList)
            {
                step.Accept(this.visitor);
            }

            return(this.result);
        }
        internal AddJobFlowStepsResponse AddJobFlowSteps(AddJobFlowStepsRequest request)
        {
            var task = AddJobFlowStepsAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
示例#9
0
        /**
         * Convert AddJobFlowStepsRequest to name value pairs
         */
        private static IDictionary <string, string> ConvertAddJobFlowSteps(AddJobFlowStepsRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "AddJobFlowSteps";
            if (request.IsSetJobFlowId())
            {
                parameters["JobFlowId"] = request.JobFlowId;
            }
            List <StepConfig> addJobFlowStepsRequestStepsList = request.Steps;
            int addJobFlowStepsRequestStepsListIndex          = 1;

            foreach (StepConfig addJobFlowStepsRequestSteps in addJobFlowStepsRequestStepsList)
            {
                if (addJobFlowStepsRequestSteps.IsSetName())
                {
                    parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "Name")] = addJobFlowStepsRequestSteps.Name;
                }
                if (addJobFlowStepsRequestSteps.IsSetActionOnFailure())
                {
                    parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "ActionOnFailure")] = addJobFlowStepsRequestSteps.ActionOnFailure;
                }
                if (addJobFlowStepsRequestSteps.IsSetHadoopJarStep())
                {
                    HadoopJarStepConfig stepsHadoopJarStep          = addJobFlowStepsRequestSteps.HadoopJarStep;
                    List <KeyValue>     hadoopJarStepPropertiesList = stepsHadoopJarStep.Properties;
                    int hadoopJarStepPropertiesListIndex            = 1;
                    foreach (KeyValue hadoopJarStepProperties in hadoopJarStepPropertiesList)
                    {
                        if (hadoopJarStepProperties.IsSetKey())
                        {
                            parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Properties", ".member.", hadoopJarStepPropertiesListIndex, ".", "Key")] = hadoopJarStepProperties.Key;
                        }
                        if (hadoopJarStepProperties.IsSetValue())
                        {
                            parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Properties", ".member.", hadoopJarStepPropertiesListIndex, ".", "Value")] = hadoopJarStepProperties.Value;
                        }

                        hadoopJarStepPropertiesListIndex++;
                    }
                    if (stepsHadoopJarStep.IsSetJar())
                    {
                        parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Jar")] = stepsHadoopJarStep.Jar;
                    }
                    if (stepsHadoopJarStep.IsSetMainClass())
                    {
                        parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "MainClass")] = stepsHadoopJarStep.MainClass;
                    }
                    List <string> hadoopJarStepArgsList      = stepsHadoopJarStep.Args;
                    int           hadoopJarStepArgsListIndex = 1;
                    foreach (string hadoopJarStepArgs in hadoopJarStepArgsList)
                    {
                        parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Args", ".member.", hadoopJarStepArgsListIndex)] = hadoopJarStepArgs;
                        hadoopJarStepArgsListIndex++;
                    }
                }

                addJobFlowStepsRequestStepsListIndex++;
            }

            return(parameters);
        }
示例#10
0
 /// <summary>
 /// Add Job Flow Steps
 /// </summary>
 /// <param name="request">Add Job Flow Steps  request</param>
 /// <returns>Add Job Flow Steps  Response from the service</returns>
 public AddJobFlowStepsResponse AddJobFlowSteps(AddJobFlowStepsRequest request)
 {
     return(Invoke <AddJobFlowStepsResponse>(ConvertAddJobFlowSteps(request)));
 }
 /// <summary>
 /// Initiates the asynchronous execution of the AddJobFlowSteps operation.
 /// <seealso cref="Amazon.ElasticMapReduce.AmazonElasticMapReduce.AddJobFlowSteps"/>
 /// </summary>
 ///
 /// <param name="addJobFlowStepsRequest">Container for the necessary parameters to execute the AddJobFlowSteps 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>
 public IAsyncResult BeginAddJobFlowSteps(AddJobFlowStepsRequest addJobFlowStepsRequest, AsyncCallback callback, object state)
 {
     return(invokeAddJobFlowSteps(addJobFlowStepsRequest, callback, state, false));
 }
        /// <summary>
        /// <para> AddJobFlowSteps adds new steps to a running job flow. A maximum of 256 steps are allowed in each job flow. </para> <para>If your job
        /// flow is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass
        /// the 256-step limitation in various ways, including using the SSH shell to connect to the master node and submitting queries directly to the
        /// software running on the master node, such as Hive and Hadoop. For more information on how to do this, go to Add More than 256 Steps to a Job
        /// Flow in the <i>Amazon Elastic MapReduce Developer's Guide</i> .</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, BOOTSTRAPPING, 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)
        {
            IAsyncResult asyncResult = invokeAddJobFlowSteps(addJobFlowStepsRequest, null, null, true);

            return(EndAddJobFlowSteps(asyncResult));
        }