Sdílet prostřednictvím


BatchClient.ReplaceJobScheduleAsync Method

Definition

Overloads

ReplaceJobScheduleAsync(String, BatchJobSchedule, Nullable<Int32>, Nullable<DateTimeOffset>, RequestConditions, CancellationToken)

Updates the properties of the specified Job Schedule.

ReplaceJobScheduleAsync(String, RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestConditions, RequestContext)

[Protocol Method] Updates the properties of the specified Job Schedule.

ReplaceJobScheduleAsync(String, BatchJobSchedule, Nullable<Int32>, Nullable<DateTimeOffset>, RequestConditions, CancellationToken)

Source:
BatchClientCustom.cs

Updates the properties of the specified Job Schedule.

public virtual System.Threading.Tasks.Task<Azure.Response> ReplaceJobScheduleAsync(string jobScheduleId, Azure.Compute.Batch.BatchJobSchedule jobSchedule, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestConditions requestConditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReplaceJobScheduleAsync : string * Azure.Compute.Batch.BatchJobSchedule * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.ReplaceJobScheduleAsync : string * Azure.Compute.Batch.BatchJobSchedule * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function ReplaceJobScheduleAsync (jobScheduleId As String, jobSchedule As BatchJobSchedule, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional requestConditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)

Parameters

jobScheduleId
String

The ID of the Job Schedule to update.

jobSchedule
BatchJobSchedule

A Job Schedule with updated properties.

timeOutInSeconds
Nullable<Int32>

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".

ocpdate
Nullable<DateTimeOffset>

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

requestConditions
RequestConditions

The content to send as the request conditions of the request.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

jobScheduleId or jobSchedule is null.

jobScheduleId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call ReplaceJobScheduleAsync.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

BatchJobSchedule jobSchedule = new BatchJobSchedule(new BatchJobSpecification(new BatchPoolInfo
{
    PoolId = "poolId",
})
{
    Priority = 0,
    UsesTaskDependencies = false,
    Constraints = new BatchJobConstraints
    {
        MaxWallClockTime = XmlConvert.ToTimeSpan("P10675199DT2H48M5.4775807S"),
        MaxTaskRetryCount = 0,
    },
})
{
    Schedule = new BatchJobScheduleConfiguration
    {
        DoNotRunUntil = DateTimeOffset.Parse("2025-01-01T12:30:00Z"),
    },
};
Response response = await client.ReplaceJobScheduleAsync("jobScheduleId", jobSchedule);

Remarks

This fully replaces all the updatable properties of the Job Schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a Job Schedule only impact Jobs created by the schedule after the update has taken place; currently running Jobs are unaffected.

Applies to

ReplaceJobScheduleAsync(String, RequestContent, Nullable<Int32>, Nullable<DateTimeOffset>, RequestConditions, RequestContext)

Source:
BatchClientCustom.cs

[Protocol Method] Updates the properties of the specified Job Schedule.

public virtual System.Threading.Tasks.Task<Azure.Response> ReplaceJobScheduleAsync(string jobScheduleId, Azure.Core.RequestContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestConditions requestConditions = default, Azure.RequestContext context = default);
abstract member ReplaceJobScheduleAsync : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.ReplaceJobScheduleAsync : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function ReplaceJobScheduleAsync (jobScheduleId As String, content As RequestContent, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional requestConditions As RequestConditions = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

jobScheduleId
String

The ID of the Job Schedule to update.

content
RequestContent

The content to send as the body of the request.

timeOutInSeconds
Nullable<Int32>

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".

ocpdate
Nullable<DateTimeOffset>

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

requestConditions
RequestConditions

The content to send as the request conditions of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

jobScheduleId or content is null.

jobScheduleId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call ReplaceJobScheduleAsync.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    schedule = new
    {
        doNotRunUntil = "2025-01-01T12:30:00Z",
    },
    jobSpecification = new
    {
        priority = 0,
        usesTaskDependencies = false,
        constraints = new
        {
            maxWallClockTime = "P10675199DT2H48M5.4775807S",
            maxTaskRetryCount = 0,
        },
        poolInfo = new
        {
            poolId = "poolId",
        },
    },
});
Response response = await client.ReplaceJobScheduleAsync("jobScheduleId", content);

Console.WriteLine(response.Status);

Applies to