JobOperations class

Definition

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.

JobOperations(client, config, serializer, deserializer)
Inheritance
builtins.object
JobOperations

Parameters

client

Client for service requests.

config

Configuration of service client.

serializer

An object model serializer.

deserializer

An object model deserializer.

Variables

api_version
class
Client API Version. Constant value: "2019-08-01.10.0".

Methods

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

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(job_id, job_delete_options=None, custom_headers=None, raw=False, **operation_config)

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(job_id, disable_tasks, job_disable_options=None, custom_headers=None, raw=False, **operation_config)

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(job_id, job_enable_options=None, custom_headers=None, raw=False, **operation_config)

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(job_id, job_get_options=None, custom_headers=None, raw=False, **operation_config)

Gets information about the specified Job.

get_all_lifetime_statistics(job_get_all_lifetime_statistics_options=None, custom_headers=None, raw=False, **operation_config)

Gets lifetime summary statistics for all of the Jobs in the specified Account.

Statistics are aggregated across all Jobs that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.

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

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.

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

Lists all of the Jobs in the specified Account.

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

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

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

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(job_id, job_patch_parameter, job_patch_options=None, custom_headers=None, raw=False, **operation_config)

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(job_id, terminate_reason=None, job_terminate_options=None, custom_headers=None, raw=False, **operation_config)

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(job_id, job_update_parameter, job_update_options=None, custom_headers=None, raw=False, **operation_config)

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(job, job_add_options=None, custom_headers=None, raw=False, **operation_config)

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

job
JobAddParameter

The Job to be added.

job_add_options
JobAddOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

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

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

job_id
str

The ID of the Job to delete.

job_delete_options
JobDeleteOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

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

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

job_id
str

The ID of the Job to disable.

disable_tasks
str or DisableJobOption

What to do with active Tasks associated with the Job. Possible values include: 'requeue', 'terminate', 'wait'

job_disable_options
JobDisableOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

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

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

job_id
str

The ID of the Job to enable.

job_enable_options
JobEnableOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

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

Gets information about the specified Job.

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

Parameters

job_id
str

The ID of the Job.

job_get_options
JobGetOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

CloudJob or ClientRawResponse if raw=true

Return type

Exceptions

get_all_lifetime_statistics(job_get_all_lifetime_statistics_options=None, custom_headers=None, raw=False, **operation_config)

Gets lifetime summary statistics for all of the Jobs in the specified Account.

Statistics are aggregated across all Jobs that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.

get_all_lifetime_statistics(job_get_all_lifetime_statistics_options=None, custom_headers=None, raw=False, **operation_config)

Parameters

job_get_all_lifetime_statistics_options
JobGetAllLifetimeStatisticsOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

JobStatistics or ClientRawResponse if raw=true

Return type

Exceptions

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

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.

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

Parameters

job_id
str

The ID of the Job.

job_get_task_counts_options
JobGetTaskCountsOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

TaskCounts or ClientRawResponse if raw=true

Return type

Exceptions

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

Lists all of the Jobs in the specified Account.

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

Parameters

job_list_options
JobListOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

An iterator like instance of CloudJob

Return type

Exceptions

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

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

job_schedule_id
str

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

job_list_from_job_schedule_options
JobListFromJobScheduleOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

An iterator like instance of CloudJob

Return type

Exceptions

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

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

job_id
str

The ID of the Job.

job_list_preparation_and_release_task_status_options
JobListPreparationAndReleaseTaskStatusOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

An iterator like instance of JobPreparationAndReleaseTaskExecutionInformation

Return type

Exceptions

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

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

job_id
str

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

job_patch_parameter
JobPatchParameter

The parameters for the request.

job_patch_options
JobPatchOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

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

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

job_id
str

The ID of the Job to terminate.

terminate_reason
str

The text you want to appear as the Job's TerminateReason. The default is 'UserTerminate'.

default value: None
job_terminate_options
JobTerminateOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

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

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

job_id
str

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

job_update_parameter
JobUpdateParameter

The parameters for the request.

job_update_options
JobUpdateOptions

Additional parameters for the operation

default value: None
custom_headers
dict

headers that will be added to the request

default value: None
raw
bool

returns the direct response alongside the deserialized response

default value: False
operation_config

Operation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

Exceptions

Attributes

models

models = <module 'azure.batch.models' from 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib\\site-packages\\azure\\batch\\models\\__init__.py'>