JobOperations Class

JobOperations operations.

You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.

Inheritance
builtins.object
JobOperations

Constructor

JobOperations(client, config, serializer, deserializer)

Parameters

Name Description
client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Variables

Name Description
api_version

The API version to use for the request. Constant value: "2024-02-01.19.0".

Methods

add

Adds a Job to the specified Account.

The Batch service supports two ways to control the work done as part of a Job. In the first approach, the user specifies a Job Manager Task. The Batch service launches this Task when it is ready to start the Job. The Job Manager Task controls all other Tasks that run under this Job, by using the Task APIs. In the second approach, the user directly controls the execution of Tasks under an active Job, by using the Task APIs. Also note: when naming Jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.

delete

Deletes a Job.

Deleting a Job also deletes all Tasks that are part of that Job, and all Job statistics. This also overrides the retention period for Task data; that is, if the Job contains Tasks which are still retained on Compute Nodes, the Batch services deletes those Tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the Job to the deleting state. All update operations on a Job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the Job is being deleted.

disable

Disables the specified Job, preventing new Tasks from running.

The Batch Service immediately moves the Job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running Tasks of the Job. The Job remains in the disabling state until the disable operation is completed and all Tasks have been dealt with according to the disableTasks option; the Job then moves to the disabled state. No new Tasks are started under the Job until it moves back to active state. If you try to disable a Job that is in any state other than active, disabling, or disabled, the request fails with status code 409.

enable

Enables the specified Job, allowing new Tasks to run.

When you call this API, the Batch service sets a disabled Job to the enabling state. After the this operation is completed, the Job moves to the active state, and scheduling of new Tasks under the Job resumes. The Batch service does not allow a Task to remain in the active state for more than 180 days. Therefore, if you enable a Job containing active Tasks which were added more than 180 days ago, those Tasks will not run.

get

Gets information about the specified Job.

get_task_counts

Gets the Task counts for the specified Job.

Task counts provide a count of the Tasks by active, running or completed Task state, and a count of Tasks which succeeded or failed. Tasks in the preparing state are counted as running. Note that the numbers returned may not always be up to date. If you need exact task counts, use a list query.

list

Lists all of the Jobs in the specified Account.

list_from_job_schedule

Lists the Jobs that have been created under the specified Job Schedule.

list_preparation_and_release_task_status

Lists the execution status of the Job Preparation and Job Release Task for the specified Job across the Compute Nodes where the Job has run.

This API returns the Job Preparation and Job Release Task status on all Compute Nodes that have run the Job Preparation or Job Release Task. This includes Compute Nodes which have since been removed from the Pool. If this API is invoked on a Job which has no Job Preparation or Job Release Task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified.

patch

Updates the properties of the specified Job.

This replaces only the Job properties specified in the request. For example, if the Job has constraints, and a request does not specify the constraints element, then the Job keeps the existing constraints.

terminate

Terminates the specified Job, marking it as completed.

When a Terminate Job request is received, the Batch service sets the Job to the terminating state. The Batch service then terminates any running Tasks associated with the Job and runs any required Job release Tasks. Then the Job moves into the completed state. If there are any Tasks in the Job in the active state, they will remain in the active state. Once a Job is terminated, new Tasks cannot be added and any remaining active Tasks will not be scheduled.

update

Updates the properties of the specified Job.

This fully replaces all the updatable properties of the Job. For example, if the Job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints.

add

Adds a Job to the specified Account.

The Batch service supports two ways to control the work done as part of a Job. In the first approach, the user specifies a Job Manager Task. The Batch service launches this Task when it is ready to start the Job. The Job Manager Task controls all other Tasks that run under this Job, by using the Task APIs. In the second approach, the user directly controls the execution of Tasks under an active Job, by using the Task APIs. Also note: when naming Jobs, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.

add(job, job_add_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job
Required

The Job to be added.

job_add_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

delete

Deletes a Job.

Deleting a Job also deletes all Tasks that are part of that Job, and all Job statistics. This also overrides the retention period for Task data; that is, if the Job contains Tasks which are still retained on Compute Nodes, the Batch services deletes those Tasks' working directories and all their contents. When a Delete Job request is received, the Batch service sets the Job to the deleting state. All update operations on a Job that is in deleting state will fail with status code 409 (Conflict), with additional information indicating that the Job is being deleted.

delete(job_id, job_delete_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job to delete.

job_delete_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

disable

Disables the specified Job, preventing new Tasks from running.

The Batch Service immediately moves the Job to the disabling state. Batch then uses the disableTasks parameter to determine what to do with the currently running Tasks of the Job. The Job remains in the disabling state until the disable operation is completed and all Tasks have been dealt with according to the disableTasks option; the Job then moves to the disabled state. No new Tasks are started under the Job until it moves back to active state. If you try to disable a Job that is in any state other than active, disabling, or disabled, the request fails with status code 409.

disable(job_id, disable_tasks, job_disable_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job to disable.

disable_tasks
Required

Possible values include: 'requeue', 'terminate', 'wait'

job_disable_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

enable

Enables the specified Job, allowing new Tasks to run.

When you call this API, the Batch service sets a disabled Job to the enabling state. After the this operation is completed, the Job moves to the active state, and scheduling of new Tasks under the Job resumes. The Batch service does not allow a Task to remain in the active state for more than 180 days. Therefore, if you enable a Job containing active Tasks which were added more than 180 days ago, those Tasks will not run.

enable(job_id, job_enable_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job to enable.

job_enable_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

get

Gets information about the specified Job.

get(job_id, job_get_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job.

job_get_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

CloudJob or ClientRawResponse if raw=true

Exceptions

Type Description

get_task_counts

Gets the Task counts for the specified Job.

Task counts provide a count of the Tasks by active, running or completed Task state, and a count of Tasks which succeeded or failed. Tasks in the preparing state are counted as running. Note that the numbers returned may not always be up to date. If you need exact task counts, use a list query.

get_task_counts(job_id, job_get_task_counts_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job.

job_get_task_counts_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

TaskCountsResult or ClientRawResponse if raw=true

Exceptions

Type Description

list

Lists all of the Jobs in the specified Account.

list(job_list_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_list_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description

An iterator like instance of CloudJob

Exceptions

Type Description

list_from_job_schedule

Lists the Jobs that have been created under the specified Job Schedule.

list_from_job_schedule(job_schedule_id, job_list_from_job_schedule_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_schedule_id
Required
str

The ID of the Job Schedule from which you want to get a list of Jobs.

job_list_from_job_schedule_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description

An iterator like instance of CloudJob

Exceptions

Type Description

list_preparation_and_release_task_status

Lists the execution status of the Job Preparation and Job Release Task for the specified Job across the Compute Nodes where the Job has run.

This API returns the Job Preparation and Job Release Task status on all Compute Nodes that have run the Job Preparation or Job Release Task. This includes Compute Nodes which have since been removed from the Pool. If this API is invoked on a Job which has no Job Preparation or Job Release Task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified.

list_preparation_and_release_task_status(job_id, job_list_preparation_and_release_task_status_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job.

job_list_preparation_and_release_task_status_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description

An iterator like instance of JobPreparationAndReleaseTaskExecutionInformation

Exceptions

Type Description

patch

Updates the properties of the specified Job.

This replaces only the Job properties specified in the request. For example, if the Job has constraints, and a request does not specify the constraints element, then the Job keeps the existing constraints.

patch(job_id, job_patch_parameter, job_patch_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job whose properties you want to update.

job_patch_parameter
Required

The parameters for the request.

job_patch_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

terminate

Terminates the specified Job, marking it as completed.

When a Terminate Job request is received, the Batch service sets the Job to the terminating state. The Batch service then terminates any running Tasks associated with the Job and runs any required Job release Tasks. Then the Job moves into the completed state. If there are any Tasks in the Job in the active state, they will remain in the active state. Once a Job is terminated, new Tasks cannot be added and any remaining active Tasks will not be scheduled.

terminate(job_id, terminate_reason=None, job_terminate_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job to terminate.

terminate_reason
str
Default value: None
job_terminate_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

update

Updates the properties of the specified Job.

This fully replaces all the updatable properties of the Job. For example, if the Job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints.

update(job_id, job_update_parameter, job_update_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
job_id
Required
str

The ID of the Job whose properties you want to update.

job_update_parameter
Required

The parameters for the request.

job_update_options

Additional parameters for the operation

Default value: None
custom_headers

headers that will be added to the request

Default value: None
raw

returns the direct response alongside the deserialized response

Default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

Attributes

models

models = <module 'azure.batch.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\batch\\models\\__init__.py'>