Sdílet prostřednictvím


BatchClient.ReplaceJobSchedule Method

Definition

Overloads

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

Updates the properties of the specified Job Schedule.

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

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

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

Source:
BatchClient.cs

Updates the properties of the specified Job Schedule.

public virtual Azure.Response ReplaceJobSchedule(string jobScheduleId, Azure.Compute.Batch.BatchJobSchedule jobSchedule, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestConditions requestConditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReplaceJobSchedule : string * Azure.Compute.Batch.BatchJobSchedule * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response
override this.ReplaceJobSchedule : string * Azure.Compute.Batch.BatchJobSchedule * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * System.Threading.CancellationToken -> Azure.Response
Public Overridable Function ReplaceJobSchedule (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 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 ReplaceJobSchedule.

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 = client.ReplaceJobSchedule("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

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

Source:
BatchClient.cs

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

public virtual Azure.Response ReplaceJobSchedule(string jobScheduleId, Azure.Core.RequestContent content, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, Azure.RequestConditions requestConditions = default, Azure.RequestContext context = default);
abstract member ReplaceJobSchedule : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
override this.ReplaceJobSchedule : string * Azure.Core.RequestContent * Nullable<int> * Nullable<DateTimeOffset> * Azure.RequestConditions * Azure.RequestContext -> Azure.Response
Public Overridable Function ReplaceJobSchedule (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 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 ReplaceJobSchedule.

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 = client.ReplaceJobSchedule("jobScheduleId", content);

Console.WriteLine(response.Status);

Applies to