Пример #1
0
        public void CannotModifyUsesTaskDependenciesOnAJobScheduleAfterItHasBeenCommitted()
        {
            const bool usesTaskDependencies = true;


            using BatchClient client = ClientUnitTestCommon.CreateDummyClient();
            Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(
                baseRequest =>
            {
                var request = (Protocol.BatchRequests.JobScheduleAddBatchRequest)baseRequest;

                request.ServiceRequestFunc = token =>
                {
                    var response = new AzureOperationHeaderResponse <Models.JobScheduleAddHeaders> {
                        Response = new HttpResponseMessage(HttpStatusCode.Created)
                    };

                    return(Task.FromResult(response));
                };
            });

            Microsoft.Azure.Batch.CloudJobSchedule cloudJobSchedule = client.JobScheduleOperations.CreateJobSchedule();
            Microsoft.Azure.Batch.JobSpecification jobSpec          = new Microsoft.Azure.Batch.JobSpecification(poolInformation: null)
            {
                UsesTaskDependencies = usesTaskDependencies
            };
            cloudJobSchedule.JobSpecification = jobSpec;
            cloudJobSchedule.Commit(new List <BatchClientBehavior> {
                interceptor
            });

            // writing isn't allowed for a CloudJobSchedule.JobSpecification.UsesTaskDependencies that is in an invalid state.
            Assert.Throws <InvalidOperationException>(() => cloudJobSchedule.JobSpecification.UsesTaskDependencies = false);
        }
Пример #2
0
 internal PSJobSpecification(Microsoft.Azure.Batch.JobSpecification omObject)
 {
     if ((omObject == null))
     {
         throw new System.ArgumentNullException("omObject");
     }
     this.omObject = omObject;
 }
 internal PSJobSpecification(Microsoft.Azure.Batch.JobSpecification omObject)
 {
     if ((omObject == null))
     {
         throw new System.ArgumentNullException("omObject");
     }
     this.omObject = omObject;
 }
Пример #4
0
 public PSJobSpecification()
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification();
 }
 public PSJobSpecification()
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification();
 }
Пример #6
0
        /// <summary>
        /// Creates an instance of CloudJobSchedule that is unbound and does not have a consistency relationship to any job schedule in the Batch Service.
        /// </summary>
        /// <param name="jobScheduleId">The id of the job schedule.</param>
        /// <param name="schedule">The schedule that determines when jobs will be created.</param>
        /// <param name="jobSpecification">a <see cref="JobSpecification" /> containing details of the jobs to be created according to the <paramref name="schedule"/>.</param>
        /// <returns>A <see cref="CloudJobSchedule"/> representing a new job schedule that has not been submitted to the Batch service.</returns>
        public CloudJobSchedule CreateJobSchedule(string jobScheduleId, Schedule schedule, JobSpecification jobSpecification)
        {
            CloudJobSchedule newJobSchedule = new CloudJobSchedule(this.ParentBatchClient, this.CustomBehaviors)
            {
                Id               = jobScheduleId,
                Schedule         = schedule,
                JobSpecification = jobSpecification
            };

            return(newJobSchedule);
        }
Пример #7
0
 public PSJobSpecification(PSPoolInformation poolInformation)
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification(poolInformation.omObject);
 }
 public PSJobSpecification(PSPoolInformation poolInformation)
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification(poolInformation.omObject);
 }