コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the JobSchedulePatchParameter class.
 /// </summary>
 /// <param name="schedule">The schedule according to which Jobs will be
 /// created.</param>
 /// <param name="jobSpecification">The details of the Jobs to be
 /// created on this schedule.</param>
 /// <param name="metadata">A list of name-value pairs associated with
 /// the Job Schedule as metadata.</param>
 public JobSchedulePatchParameter(Schedule schedule = default(Schedule), JobSpecification jobSpecification = default(JobSpecification), IList <MetadataItem> metadata = default(IList <MetadataItem>))
 {
     Schedule         = schedule;
     JobSpecification = jobSpecification;
     Metadata         = metadata;
     CustomInit();
 }
コード例 #2
0
ファイル: CloudJobSchedule.cs プロジェクト: QITIE/ADLSTool
        /// <summary>
        /// Commits all pending changes to this <see cref="CloudJobSchedule" /> to the Azure Batch service.
        /// </summary>
        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are applied to the Batch service request after the <see cref="CustomBehaviors"/>.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param>
        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
        /// <remarks>
        /// <para>
        /// Updates an existing <see cref="CloudJobSchedule"/> on the Batch service by replacing its properties with the properties of this <see cref="CloudJobSchedule"/> which have been changed.
        /// Unchanged properties are ignored.
        /// All changes since the last time this entity was retrieved from the Batch service (either via <see cref="Refresh"/>, <see cref="JobScheduleOperations.GetJobSchedule"/>,
        /// or <see cref="JobScheduleOperations.ListJobSchedules"/>) are applied.
        /// Properties which are explicitly set to null will cause an exception because the Batch service does not support partial updates which set a property to null.
        /// If you need to set a property to null, use <see cref="Commit"/>.
        /// </para>
        /// <para>This operation runs asynchronously.</para>
        /// </remarks>
        public async System.Threading.Tasks.Task CommitChangesAsync(
            IEnumerable <BatchClientBehavior> additionalBehaviors = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);

            // after this no prop access is allowed
            this.propertyContainer.IsReadOnly = true;

            // craft the bahavior manager for this call
            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);

            Models.JobSpecification jobSpecification = this.propertyContainer.JobSpecificationProperty.GetTransportObjectIfChanged <JobSpecification, Models.JobSpecification>();
            Models.Schedule         schedule         = this.propertyContainer.ScheduleProperty.GetTransportObjectIfChanged <Schedule, Models.Schedule>();
            Models.MetadataItem[]   metadata         = this.propertyContainer.MetadataProperty.GetTransportObjectIfChanged <MetadataItem, Models.MetadataItem>();

            System.Threading.Tasks.Task asyncJobScheduleUpdate =
                this.parentBatchClient.ProtocolLayer.PatchJobSchedule(
                    this.Id,
                    jobSpecification,
                    metadata,
                    schedule,
                    bhMgr,
                    cancellationToken);

            await asyncJobScheduleUpdate.ConfigureAwait(continueOnCapturedContext : false);
        }
コード例 #3
0
 public PropertyContainer(Models.JobSpecification protocolObject) : base(BindingState.Bound)
 {
     this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor(
         EnvironmentSetting.ConvertFromProtocolCollection(protocolObject.CommonEnvironmentSettings),
         nameof(CommonEnvironmentSettings),
         BindingAccess.Read | BindingAccess.Write);
     this.ConstraintsProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Constraints, o => new JobConstraints(o)),
         nameof(Constraints),
         BindingAccess.Read | BindingAccess.Write);
     this.DisplayNameProperty = this.CreatePropertyAccessor(
         protocolObject.DisplayName,
         nameof(DisplayName),
         BindingAccess.Read | BindingAccess.Write);
     this.JobManagerTaskProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobManagerTask, o => new JobManagerTask(o)),
         nameof(JobManagerTask),
         BindingAccess.Read | BindingAccess.Write);
     this.JobPreparationTaskProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobPreparationTask, o => new JobPreparationTask(o)),
         nameof(JobPreparationTask),
         BindingAccess.Read | BindingAccess.Write);
     this.JobReleaseTaskProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobReleaseTask, o => new JobReleaseTask(o)),
         nameof(JobReleaseTask),
         BindingAccess.Read | BindingAccess.Write);
     this.MaxParallelTasksProperty = this.CreatePropertyAccessor(
         protocolObject.MaxParallelTasks,
         nameof(MaxParallelTasks),
         BindingAccess.Read | BindingAccess.Write);
     this.MetadataProperty = this.CreatePropertyAccessor(
         MetadataItem.ConvertFromProtocolCollection(protocolObject.Metadata),
         nameof(Metadata),
         BindingAccess.Read | BindingAccess.Write);
     this.NetworkConfigurationProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.NetworkConfiguration, o => new JobNetworkConfiguration(o).Freeze()),
         nameof(NetworkConfiguration),
         BindingAccess.Read);
     this.OnAllTasksCompleteProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.MapNullableEnum <Models.OnAllTasksComplete, Common.OnAllTasksComplete>(protocolObject.OnAllTasksComplete),
         nameof(OnAllTasksComplete),
         BindingAccess.Read | BindingAccess.Write);
     this.OnTaskFailureProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.MapNullableEnum <Models.OnTaskFailure, Common.OnTaskFailure>(protocolObject.OnTaskFailure),
         nameof(OnTaskFailure),
         BindingAccess.Read | BindingAccess.Write);
     this.PoolInformationProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.PoolInfo, o => new PoolInformation(o)),
         nameof(PoolInformation),
         BindingAccess.Read | BindingAccess.Write);
     this.PriorityProperty = this.CreatePropertyAccessor(
         protocolObject.Priority,
         nameof(Priority),
         BindingAccess.Read | BindingAccess.Write);
     this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor(
         protocolObject.UsesTaskDependencies,
         nameof(UsesTaskDependencies),
         BindingAccess.Read | BindingAccess.Write);
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the JobScheduleAddParameter class.
 /// </summary>
 /// <param name="id">A string that uniquely identifies the schedule
 /// within the account.</param>
 /// <param name="schedule">The schedule according to which jobs will
 /// be created.</param>
 /// <param name="jobSpecification">The details of the jobs to be
 /// created on this schedule.</param>
 /// <param name="displayName">The display name for the
 /// schedule.</param>
 /// <param name="metadata">A list of name-value pairs associated with
 /// the schedule as metadata.</param>
 public JobScheduleAddParameter(string id, Schedule schedule, JobSpecification jobSpecification, string displayName = default(string), System.Collections.Generic.IList <MetadataItem> metadata = default(System.Collections.Generic.IList <MetadataItem>))
 {
     Id               = id;
     DisplayName      = displayName;
     Schedule         = schedule;
     JobSpecification = jobSpecification;
     Metadata         = metadata;
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the JobScheduleAddParameter class.
 /// </summary>
 /// <param name="id">A string that uniquely identifies the schedule
 /// within the account.</param>
 /// <param name="schedule">The schedule according to which jobs will be
 /// created.</param>
 /// <param name="jobSpecification">The details of the jobs to be
 /// created on this schedule.</param>
 /// <param name="displayName">The display name for the
 /// schedule.</param>
 /// <param name="metadata">A list of name-value pairs associated with
 /// the schedule as metadata.</param>
 public JobScheduleAddParameter(string id, Schedule schedule, JobSpecification jobSpecification, string displayName = default(string), IList <MetadataItem> metadata = default(IList <MetadataItem>))
 {
     Id               = id;
     DisplayName      = displayName;
     Schedule         = schedule;
     JobSpecification = jobSpecification;
     Metadata         = metadata;
     CustomInit();
 }
コード例 #6
0
        /// <summary>
        /// Builds a CloudJobScheduleGetResponse object
        /// </summary>
        public static ProxyModels.CloudJobScheduleGetResponse CreateCloudJobScheduleGetResponse(string jobScheduleId)
        {
            ProxyModels.CloudJobScheduleGetResponse response = new ProxyModels.CloudJobScheduleGetResponse();
            response.StatusCode = HttpStatusCode.OK;

            ProxyModels.JobSpecification jobSpec  = new ProxyModels.JobSpecification();
            ProxyModels.Schedule         schedule = new ProxyModels.Schedule();

            ProxyModels.CloudJobSchedule jobSchedule = new ProxyModels.CloudJobSchedule(jobScheduleId, schedule, jobSpec);
            response.JobSchedule = jobSchedule;

            return(response);
        }
コード例 #7
0
        /// <summary>
        /// Builds a CloudJobScheduleGetResponse object
        /// </summary>
        public static AzureOperationResponse <ProxyModels.CloudJobSchedule, ProxyModels.JobScheduleGetHeaders> CreateCloudJobScheduleGetResponse(string jobScheduleId)
        {
            var response = new AzureOperationResponse <ProxyModels.CloudJobSchedule, ProxyModels.JobScheduleGetHeaders>();

            response.Response = new HttpResponseMessage(HttpStatusCode.OK);

            ProxyModels.JobSpecification jobSpec  = new ProxyModels.JobSpecification();
            ProxyModels.Schedule         schedule = new ProxyModels.Schedule();

            ProxyModels.CloudJobSchedule jobSchedule = new ProxyModels.CloudJobSchedule(id: jobScheduleId, schedule: schedule, jobSpecification: jobSpec);
            response.Body = jobSchedule;

            return(response);
        }
コード例 #8
0
ファイル: CloudJobSchedule.cs プロジェクト: QITIE/ADLSTool
 /// <summary>
 /// Initializes a new instance of the CloudJobSchedule class.
 /// </summary>
 /// <param name="id">A string that uniquely identifies the schedule
 /// within the account.</param>
 /// <param name="displayName">The display name for the
 /// schedule.</param>
 /// <param name="url">The URL of the job schedule.</param>
 /// <param name="eTag">The ETag of the job schedule.</param>
 /// <param name="lastModified">The last modified time of the job
 /// schedule.</param>
 /// <param name="creationTime">The creation time of the job
 /// schedule.</param>
 /// <param name="state">The current state of the job schedule.</param>
 /// <param name="stateTransitionTime">The time at which the job
 /// schedule entered the current state.</param>
 /// <param name="previousState">The previous state of the job
 /// schedule.</param>
 /// <param name="previousStateTransitionTime">The time at which the
 /// job schedule entered its previous state.</param>
 /// <param name="schedule">The schedule according to which jobs will
 /// be created.</param>
 /// <param name="jobSpecification">The details of the jobs to be
 /// created on this schedule.</param>
 /// <param name="executionInfo">Information about jobs that have been
 /// and will be run under this schedule.</param>
 /// <param name="metadata">A list of name-value pairs associated with
 /// the schedule as metadata.</param>
 /// <param name="stats">The lifetime resource usage statistics for the
 /// job schedule.</param>
 public CloudJobSchedule(string id = default(string), string displayName = default(string), string url = default(string), string eTag = default(string), System.DateTime?lastModified = default(System.DateTime?), System.DateTime?creationTime = default(System.DateTime?), JobScheduleState?state = default(JobScheduleState?), System.DateTime?stateTransitionTime = default(System.DateTime?), JobScheduleState?previousState = default(JobScheduleState?), System.DateTime?previousStateTransitionTime = default(System.DateTime?), Schedule schedule = default(Schedule), JobSpecification jobSpecification = default(JobSpecification), JobScheduleExecutionInformation executionInfo = default(JobScheduleExecutionInformation), System.Collections.Generic.IList <MetadataItem> metadata = default(System.Collections.Generic.IList <MetadataItem>), JobScheduleStatistics stats = default(JobScheduleStatistics))
 {
     Id                          = id;
     DisplayName                 = displayName;
     Url                         = url;
     ETag                        = eTag;
     LastModified                = lastModified;
     CreationTime                = creationTime;
     State                       = state;
     StateTransitionTime         = stateTransitionTime;
     PreviousState               = previousState;
     PreviousStateTransitionTime = previousStateTransitionTime;
     Schedule                    = schedule;
     JobSpecification            = jobSpecification;
     ExecutionInfo               = executionInfo;
     Metadata                    = metadata;
     Stats                       = stats;
 }
コード例 #9
0
        /// <summary>
        /// Builds a CloudJobScheduleListResponse object
        /// </summary>
        public static ProxyModels.CloudJobScheduleListResponse CreateCloudJobScheduleListResponse(IEnumerable <string> jobScheduleIds)
        {
            ProxyModels.CloudJobScheduleListResponse response = new ProxyModels.CloudJobScheduleListResponse();
            response.StatusCode = HttpStatusCode.OK;;

            List <ProxyModels.CloudJobSchedule> jobSchedules = new List <ProxyModels.CloudJobSchedule>();

            ProxyModels.JobSpecification jobSpec  = new ProxyModels.JobSpecification();
            ProxyModels.Schedule         schedule = new ProxyModels.Schedule();

            foreach (string id in jobScheduleIds)
            {
                jobSchedules.Add(new ProxyModels.CloudJobSchedule(id, schedule, jobSpec));
            }

            response.JobSchedules = jobSchedules;

            return(response);
        }
コード例 #10
0
 public PropertyContainer(Models.JobSpecification protocolObject) : base(BindingState.Bound)
 {
     this.CommonEnvironmentSettingsProperty = this.CreatePropertyAccessor(
         EnvironmentSetting.ConvertFromProtocolCollection(protocolObject.CommonEnvironmentSettings),
         "CommonEnvironmentSettings",
         BindingAccess.Read | BindingAccess.Write);
     this.ConstraintsProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Constraints, o => new JobConstraints(o)),
         "Constraints",
         BindingAccess.Read | BindingAccess.Write);
     this.DisplayNameProperty = this.CreatePropertyAccessor(
         protocolObject.DisplayName,
         "DisplayName",
         BindingAccess.Read | BindingAccess.Write);
     this.JobManagerTaskProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobManagerTask, o => new JobManagerTask(o)),
         "JobManagerTask",
         BindingAccess.Read | BindingAccess.Write);
     this.JobPreparationTaskProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobPreparationTask, o => new JobPreparationTask(o)),
         "JobPreparationTask",
         BindingAccess.Read | BindingAccess.Write);
     this.JobReleaseTaskProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobReleaseTask, o => new JobReleaseTask(o)),
         "JobReleaseTask",
         BindingAccess.Read | BindingAccess.Write);
     this.MetadataProperty = this.CreatePropertyAccessor(
         MetadataItem.ConvertFromProtocolCollection(protocolObject.Metadata),
         "Metadata",
         BindingAccess.Read | BindingAccess.Write);
     this.PoolInformationProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.PoolInfo, o => new PoolInformation(o)),
         "PoolInformation",
         BindingAccess.Read | BindingAccess.Write);
     this.PriorityProperty = this.CreatePropertyAccessor(
         protocolObject.Priority,
         "Priority",
         BindingAccess.Read | BindingAccess.Write);
     this.UsesTaskDependenciesProperty = this.CreatePropertyAccessor(
         protocolObject.UsesTaskDependencies,
         "UsesTaskDependencies",
         BindingAccess.Read | BindingAccess.Write);
 }
コード例 #11
0
        /// <summary>
        /// Builds a CloudJobScheduleListResponse object
        /// </summary>
        public static AzureOperationResponse <IPage <ProxyModels.CloudJobSchedule>, ProxyModels.JobScheduleListHeaders> CreateCloudJobScheduleListResponse(IEnumerable <string> jobScheduleIds)
        {
            var response = new AzureOperationResponse <IPage <ProxyModels.CloudJobSchedule>, ProxyModels.JobScheduleListHeaders>();

            response.Response = new HttpResponseMessage(HttpStatusCode.OK);

            List <ProxyModels.CloudJobSchedule> jobSchedules = new List <ProxyModels.CloudJobSchedule>();

            ProxyModels.JobSpecification jobSpec  = new ProxyModels.JobSpecification();
            ProxyModels.Schedule         schedule = new ProxyModels.Schedule();

            foreach (string id in jobScheduleIds)
            {
                jobSchedules.Add(new ProxyModels.CloudJobSchedule(id: id, schedule: schedule, jobSpecification: jobSpec));
            }

            response.Body = new MockPagedEnumerable <ProxyModels.CloudJobSchedule>(jobSchedules);

            return(response);
        }
コード例 #12
0
ファイル: CloudJobSchedule.cs プロジェクト: QITIE/ADLSTool
        /// <summary>
        /// Commits this <see cref="CloudJobSchedule" /> to the Azure Batch service.
        /// </summary>
        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are applied to the Batch service request after the <see cref="CustomBehaviors"/>.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param>
        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
        /// <remarks>
        /// <para>The commit operation runs asynchronously.</para>
        /// </remarks>
        public async System.Threading.Tasks.Task CommitAsync(
            IEnumerable <BatchClientBehavior> additionalBehaviors = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            // after this no prop access is allowed
            this.propertyContainer.IsReadOnly = true;

            // craft the behavior manager for this call
            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);

            // fetch props with admin rights so we can make calls, etc.

            if (BindingState.Unbound == this.propertyContainer.BindingState)
            {
                // take all property changes and create a job schedule
                Models.JobScheduleAddParameter protoJobSchedule = this.GetTransportObject <Models.JobScheduleAddParameter>();

                System.Threading.Tasks.Task <AzureOperationHeaderResponse <Models.JobScheduleAddHeaders> > asyncTask =
                    this.parentBatchClient.ProtocolLayer.AddJobSchedule(protoJobSchedule, bhMgr, cancellationToken);

                await asyncTask.ConfigureAwait(continueOnCapturedContext : false);
            }
            else
            {
                Models.JobSpecification jobSpecification = UtilitiesInternal.CreateObjectWithNullCheck(this.JobSpecification, o => o.GetTransportObject());
                Models.Schedule         schedule         = UtilitiesInternal.CreateObjectWithNullCheck(this.Schedule, o => o.GetTransportObject());
                Models.MetadataItem[]   metadata         = UtilitiesInternal.ConvertToProtocolArray(this.Metadata);

                System.Threading.Tasks.Task <AzureOperationHeaderResponse <Models.JobScheduleUpdateHeaders> > asyncJobScheduleUpdate =
                    this.parentBatchClient.ProtocolLayer.UpdateJobSchedule(
                        this.Id,
                        jobSpecification,
                        metadata,
                        schedule,
                        bhMgr,
                        cancellationToken);

                await asyncJobScheduleUpdate.ConfigureAwait(continueOnCapturedContext : false);
            }
        }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the JobScheduleAddParameter class.
 /// </summary>
 public JobScheduleAddParameter()
 {
     JobSpecification = new JobSpecification();
     CustomInit();
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the JobSchedulePatchParameter class.
 /// </summary>
 /// <param name="schedule">The schedule according to which jobs will
 /// be created.</param>
 /// <param name="jobSpecification">The details of the jobs to be
 /// created on this schedule.</param>
 /// <param name="metadata">A list of name-value pairs associated with
 /// the job schedule as metadata.</param>
 public JobSchedulePatchParameter(Schedule schedule = default(Schedule), JobSpecification jobSpecification = default(JobSpecification), System.Collections.Generic.IList <MetadataItem> metadata = default(System.Collections.Generic.IList <MetadataItem>))
 {
     Schedule         = schedule;
     JobSpecification = jobSpecification;
     Metadata         = metadata;
 }
コード例 #15
0
        /// <summary>
        /// Builds a CloudJobScheduleListResponse object
        /// </summary>
        public static ProxyModels.CloudJobScheduleListResponse CreateCloudJobScheduleListResponse(IEnumerable<string> jobScheduleIds)
        {
            ProxyModels.CloudJobScheduleListResponse response = new ProxyModels.CloudJobScheduleListResponse();
            response.StatusCode = HttpStatusCode.OK;;

            List<ProxyModels.CloudJobSchedule> jobSchedules = new List<ProxyModels.CloudJobSchedule>();
            ProxyModels.JobSpecification jobSpec = new ProxyModels.JobSpecification();
            ProxyModels.Schedule schedule = new ProxyModels.Schedule();

            foreach (string id in jobScheduleIds)
            {
                jobSchedules.Add(new ProxyModels.CloudJobSchedule(id, schedule, jobSpec));
            }

            response.JobSchedules = jobSchedules;

            return response;
        }
コード例 #16
0
        /// <summary>
        /// Builds a CloudJobScheduleGetResponse object
        /// </summary>
        public static ProxyModels.CloudJobScheduleGetResponse CreateCloudJobScheduleGetResponse(string jobScheduleId)
        {
            ProxyModels.CloudJobScheduleGetResponse response = new ProxyModels.CloudJobScheduleGetResponse();
            response.StatusCode = HttpStatusCode.OK;

            ProxyModels.JobSpecification jobSpec = new ProxyModels.JobSpecification();
            ProxyModels.Schedule schedule = new ProxyModels.Schedule();

            ProxyModels.CloudJobSchedule jobSchedule = new ProxyModels.CloudJobSchedule(jobScheduleId, schedule, jobSpec);
            response.JobSchedule = jobSchedule;

            return response;
        }