public static ApplicationSubmissionContext NewInstance(ApplicationId applicationId
                                                               , string applicationName, string queue, Priority priority, ContainerLaunchContext
                                                               amContainer, bool isUnmanagedAM, bool cancelTokensWhenComplete, int maxAppAttempts
                                                               , Resource resource, string applicationType, bool keepContainers, string appLabelExpression
                                                               , string amContainerLabelExpression)
        {
            ApplicationSubmissionContext context = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                   <ApplicationSubmissionContext>();

            context.SetApplicationId(applicationId);
            context.SetApplicationName(applicationName);
            context.SetQueue(queue);
            context.SetPriority(priority);
            context.SetAMContainerSpec(amContainer);
            context.SetUnmanagedAM(isUnmanagedAM);
            context.SetCancelTokensWhenComplete(cancelTokensWhenComplete);
            context.SetMaxAppAttempts(maxAppAttempts);
            context.SetApplicationType(applicationType);
            context.SetKeepContainersAcrossApplicationAttempts(keepContainers);
            context.SetNodeLabelExpression(appLabelExpression);
            context.SetResource(resource);
            ResourceRequest amReq = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <ResourceRequest
                                                                                   >();

            amReq.SetResourceName(ResourceRequest.Any);
            amReq.SetCapability(resource);
            amReq.SetNumContainers(1);
            amReq.SetRelaxLocality(true);
            amReq.SetNodeLabelExpression(amContainerLabelExpression);
            context.SetAMContainerResourceRequest(amReq);
            return(context);
        }
        public static ApplicationSubmissionContext NewInstance(ApplicationId applicationId
                                                               , string applicationName, string queue, ContainerLaunchContext amContainer, bool
                                                               isUnmanagedAM, bool cancelTokensWhenComplete, int maxAppAttempts, string applicationType
                                                               , bool keepContainers, string appLabelExpression, ResourceRequest resourceRequest
                                                               )
        {
            ApplicationSubmissionContext context = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                   <ApplicationSubmissionContext>();

            context.SetApplicationId(applicationId);
            context.SetApplicationName(applicationName);
            context.SetQueue(queue);
            context.SetAMContainerSpec(amContainer);
            context.SetUnmanagedAM(isUnmanagedAM);
            context.SetCancelTokensWhenComplete(cancelTokensWhenComplete);
            context.SetMaxAppAttempts(maxAppAttempts);
            context.SetApplicationType(applicationType);
            context.SetKeepContainersAcrossApplicationAttempts(keepContainers);
            context.SetNodeLabelExpression(appLabelExpression);
            context.SetAMContainerResourceRequest(resourceRequest);
            return(context);
        }