public NewTaskParameters(BatchAccountContext context, string jobId, PSCloudJob job, string taskId, IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, jobId, job, additionalBehaviors) { if (string.IsNullOrWhiteSpace(taskId)) { throw new ArgumentNullException("taskId"); } this.TaskId = taskId; }
public NewBulkTaskParameters(BatchAccountContext context, string jobId, PSCloudJob job, PSCloudTask[] tasks, IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, jobId, job, additionalBehaviors) { if (tasks == null) { throw new ArgumentNullException("taskCollection"); } this.Tasks = tasks; }
public JobOperationParameters(BatchAccountContext context, string jobId, PSCloudJob job, IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors) { if (string.IsNullOrWhiteSpace(jobId) && job == null) { throw new ArgumentNullException(Resources.NoJob); } this.JobId = jobId; this.Job = job; }
/// <summary> /// Lists the jobs matching the specified filter options. /// </summary> /// <param name="options">The options to use when querying for jobs.</param> /// <returns>The jobs matching the specified filter options.</returns> public IEnumerable<PSCloudJob> ListJobs(ListJobOptions options) { if (options == null) { throw new ArgumentNullException("options"); } // Get the single job matching the specified id if (!string.IsNullOrEmpty(options.JobId)) { WriteVerbose(string.Format(Resources.GetJobById, options.JobId)); JobOperations jobOperations = options.Context.BatchOMClient.JobOperations; ODATADetailLevel getDetailLevel = new ODATADetailLevel(selectClause: options.Select, expandClause: options.Expand); CloudJob job = jobOperations.GetJob(options.JobId, detailLevel: getDetailLevel, additionalBehaviors: options.AdditionalBehaviors); PSCloudJob psJob = new PSCloudJob(job); return new PSCloudJob[] { psJob }; } // List jobs using the specified filter else { string jobScheduleId = options.JobSchedule == null ? options.JobScheduleId : options.JobSchedule.Id; bool filterByJobSchedule = !string.IsNullOrEmpty(jobScheduleId); ODATADetailLevel listDetailLevel = new ODATADetailLevel(selectClause: options.Select, expandClause: options.Expand); string verboseLogString = null; if (!string.IsNullOrEmpty(options.Filter)) { verboseLogString = filterByJobSchedule ? Resources.GetJobByOData : string.Format(Resources.GetJobByODataAndJobSChedule, jobScheduleId); listDetailLevel.FilterClause = options.Filter; } else { verboseLogString = filterByJobSchedule ? Resources.GetJobNoFilter : string.Format(Resources.GetJobByJobScheduleNoFilter, jobScheduleId); } WriteVerbose(verboseLogString); IPagedEnumerable<CloudJob> jobs = null; if (filterByJobSchedule) { JobScheduleOperations jobScheduleOperations = options.Context.BatchOMClient.JobScheduleOperations; jobs = jobScheduleOperations.ListJobs(jobScheduleId, listDetailLevel, options.AdditionalBehaviors); } else { JobOperations jobOperations = options.Context.BatchOMClient.JobOperations; jobs = jobOperations.ListJobs(listDetailLevel, options.AdditionalBehaviors); } Func<CloudJob, PSCloudJob> mappingFunction = j => { return new PSCloudJob(j); }; return PSPagedEnumerable<PSCloudJob, CloudJob>.CreateWithMaxCount( jobs, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount))); } }
/// <summary> /// Lists the jobs matching the specified filter options /// </summary> /// <param name="options">The options to use when querying for jobs</param> /// <returns>The jobs matching the specified filter options</returns> public IEnumerable<PSCloudJob> ListJobs(ListJobOptions options) { if (options == null) { throw new ArgumentNullException("options"); } string wiName = options.WorkItem == null ? options.WorkItemName : options.WorkItem.Name; // Get the single job matching the specified name if (!string.IsNullOrEmpty(options.JobName)) { WriteVerbose(string.Format(Resources.GBJ_GetByName, options.JobName, wiName)); using (IWorkItemManager wiManager = options.Context.BatchOMClient.OpenWorkItemManager()) { ICloudJob job = wiManager.GetJob(wiName, options.JobName, additionalBehaviors: options.AdditionalBehaviors); PSCloudJob psJob = new PSCloudJob(job); return new PSCloudJob[] { psJob }; } } // List jobs using the specified filter else { ODATADetailLevel odata = null; string verboseLogString = null; if (!string.IsNullOrEmpty(options.Filter)) { verboseLogString = string.Format(Resources.GBJ_GetByOData, wiName); odata = new ODATADetailLevel(filterClause: options.Filter); } else { verboseLogString = string.Format(Resources.GBJ_GetNoFilter, wiName); } WriteVerbose(verboseLogString); using (IWorkItemManager wiManager = options.Context.BatchOMClient.OpenWorkItemManager()) { IEnumerableAsyncExtended<ICloudJob> jobs = wiManager.ListJobs(wiName, odata, options.AdditionalBehaviors); Func<ICloudJob, PSCloudJob> mappingFunction = j => { return new PSCloudJob(j); }; return PSAsyncEnumerable<PSCloudJob, ICloudJob>.CreateWithMaxCount( jobs, mappingFunction, options.MaxCount, () => WriteVerbose(string.Format(Resources.MaxCount, options.MaxCount))); } } }
public GetTaskCountsOptions(BatchAccountContext context, string jobId, PSCloudJob job, IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, jobId, job, additionalBehaviors) { }
public TerminateJobParameters(BatchAccountContext context, string jobId, PSCloudJob job, IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, jobId, job, additionalBehaviors) { }
public NewTaskParameters(BatchAccountContext context, string workItemName, string jobName, PSCloudJob job, string taskName, IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, workItemName, jobName, job, additionalBehaviors) { if (string.IsNullOrWhiteSpace(taskName)) { throw new ArgumentNullException("taskName"); } this.TaskName = taskName; }
public JobOperationParameters(BatchAccountContext context, string workItemName, string jobName, PSCloudJob job, IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, additionalBehaviors) { if ((string.IsNullOrWhiteSpace(workItemName) || string.IsNullOrWhiteSpace(jobName)) && job == null) { throw new ArgumentNullException(Resources.NoJob); } this.WorkItemName = workItemName; this.JobName = jobName; this.Job = job; }
public DisableJobParameters(BatchAccountContext context, string jobId, PSCloudJob job, DisableJobOption disableJobOption, IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, jobId, job, additionalBehaviors) { this.DisableJobOption = disableJobOption; }
public TerminateJobParameters(BatchAccountContext context, string jobId, PSCloudJob job, IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, jobId, job, additionalBehaviors) { }
public DisableJobParameters(BatchAccountContext context, string jobId, PSCloudJob job, DisableJobOption disableJobOption, IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, jobId, job, additionalBehaviors) { this.DisableJobOption = disableJobOption; }
/// <summary> /// Commits changes to a PSCloudJob object to the Batch Service. /// </summary> /// <param name="context">The account to use.</param> /// <param name="job">The PSCloudJob object representing the job to update.</param> /// <param name="additionBehaviors">Additional client behaviors to perform.</param> public void UpdateJob(BatchAccountContext context, PSCloudJob job, IEnumerable<BatchClientBehavior> additionBehaviors = null) { if (job == null) { throw new ArgumentNullException("job"); } WriteVerbose(string.Format(Resources.UpdatingJob, job.Id)); Utils.Utils.BoundJobSyncCollections(job); job.omObject.Commit(additionBehaviors); }
public ListTaskOptions(BatchAccountContext context, string workItemName, string jobName, PSCloudJob job, IEnumerable<BatchClientBehavior> additionalBehaviors = null) : base(context, workItemName, jobName, job, additionalBehaviors) { }
public ListTaskOptions(BatchAccountContext context, string workItemName, string jobName, PSCloudJob job, IEnumerable <BatchClientBehavior> additionalBehaviors = null) : base(context, workItemName, jobName, job, additionalBehaviors) { }
private void AssertJobIsCompleteDueToTaskFailure(PSCloudJob job) { Assert.Equal(Azure.Batch.Common.JobState.Completed, job.State); Assert.Equal("TaskFailed", job.ExecutionInformation.TerminateReason); }