BatchJob Class

An Azure Batch Job.

Constructor

BatchJob(*args: Any, **kwargs: Any)

Variables

Name Description
id
str

A string that uniquely identifies the Job within the Account. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). Required.

display_name
str

The display name for the Job.

uses_task_dependencies

Whether Tasks in the Job can define dependencies on each other. The default is false.

url
str

The URL of the Job. Required.

etag
str

The ETag of the Job. This is an opaque string. You can use it to detect whether the Job has changed between requests. In particular, you can be pass the ETag when updating a Job to specify that your changes should take effect only if nobody else has modified the Job in the meantime. Required.

last_modified

The last modified time of the Job. This is the last time at which the Job level data, such as the Job state or priority, changed. It does not factor in task-level changes such as adding new Tasks or Tasks changing state. Required.

creation_time

The creation time of the Job. Required.

state

The current state of the Job. Required. Known values are: "active", "disabling", "disabled", "enabling", "terminating", "completed", and "deleting".

state_transition_time

The time at which the Job entered its current state. Required.

previous_state

The previous state of the Job. This property is not set if the Job is in its initial Active state. Known values are: "active", "disabling", "disabled", "enabling", "terminating", "completed", and "deleting".

previous_state_transition_time

The time at which the Job entered its previous state. This property is not set if the Job is in its initial Active state.

priority
int

The priority of the Job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.

allow_task_preemption

Whether Tasks in this job can be preempted by other high priority jobs. (This property is not available by default. Please contact support for more information) If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.

max_parallel_tasks
int

The maximum number of tasks that can be executed in parallel for the job. (This property is not available by default. Please contact support for more information) The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.

constraints

The execution constraints for the Job.

job_manager_task

Details of a Job Manager Task to be launched when the Job is started.

job_preparation_task

The Job Preparation Task. The Job Preparation Task is a special Task run on each Compute Node before any other Task of the Job.

job_release_task

The Job Release Task. The Job Release Task is a special Task run at the end of the Job on each Compute Node that has run any other Task of the Job.

common_environment_settings

The list of common environment variable settings. These environment variables are set for all Tasks in the Job (including the Job Manager, Job Preparation and Job Release Tasks). Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value.

pool_info

The Pool settings associated with the Job. Required.

all_tasks_complete_mode

The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. Known values are: "noaction" and "terminatejob".

task_failure_mode

The action the Batch service should take when any Task in the Job fails. A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. Known values are: "noaction" and "performexitoptionsjobaction".

network_configuration

(This property is not available by default. Please contact support for more information) The network configuration for the Job.

metadata

A list of name-value pairs associated with the Job as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code.

execution_info

The execution information for the Job.

job_statistics

Resource usage statistics for the entire lifetime of the Job. This property is populated only if the BatchJob was retrieved with an expand clause including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.

Methods

as_dict

Return a dict that can be turned into json using json.dump.

clear

Remove all items from D.

copy
get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: D[k] if k in D, else d. :rtype: any

items
keys
pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if D is empty.

setdefault

Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any

update

Updates D from mapping/iterable E and F. :param any args: Either a mapping object or an iterable of key-value pairs.

values

as_dict

Return a dict that can be turned into json using json.dump.

as_dict(*, exclude_readonly: bool = False) -> dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Default value: False

Returns

Type Description

A dict JSON compatible object

clear

Remove all items from D.

clear() -> None

copy

copy() -> Model

get

Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: D[k] if k in D, else d. :rtype: any

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

items

items() -> ItemsView[str, Any]

Returns

Type Description

set-like object providing a view on D's items

keys

keys() -> KeysView[str]

Returns

Type Description

a set-like object providing a view on D's keys

pop

Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

popitem

Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if D is empty.

popitem() -> tuple[str, Any]

setdefault

Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

update

Updates D from mapping/iterable E and F. :param any args: Either a mapping object or an iterable of key-value pairs.

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Returns

Type Description

an object providing a view on D's values

Attributes

all_tasks_complete_mode

The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. Known values are: "noaction" and "terminatejob".

all_tasks_complete_mode: str | _models.BatchAllTasksCompleteMode | None

allow_task_preemption

Whether Tasks in this job can be preempted by other high priority jobs. (This property is not available by default. Please contact support for more information) If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.

allow_task_preemption: bool | None

common_environment_settings

The list of common environment variable settings. These environment variables are set for all Tasks in the Job (including the Job Manager, Job Preparation and Job Release Tasks). Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value.

common_environment_settings: list['_models.EnvironmentSetting'] | None

constraints

The execution constraints for the Job.

constraints: _models.BatchJobConstraints | None

creation_time

The creation time of the Job. Required.

creation_time: datetime

display_name

The display name for the Job.

display_name: str | None

etag

The ETag of the Job. This is an opaque string. You can use it to detect whether the Job has changed between requests. In particular, you can be pass the ETag when updating a Job to specify that your changes should take effect only if nobody else has modified the Job in the meantime. Required.

etag: str

execution_info

The execution information for the Job.

execution_info: _models.BatchJobExecutionInfo | None

id

A string that uniquely identifies the Job within the Account. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). Required.

id: str

job_manager_task

Details of a Job Manager Task to be launched when the Job is started.

job_manager_task: _models.BatchJobManagerTask | None

job_preparation_task

The Job Preparation Task. The Job Preparation Task is a special Task run on each Compute Node before any other Task of the Job.

job_preparation_task: _models.BatchJobPreparationTask | None

job_release_task

The Job Release Task. The Job Release Task is a special Task run at the end of the Job on each Compute Node that has run any other Task of the Job.

job_release_task: _models.BatchJobReleaseTask | None

job_statistics

Resource usage statistics for the entire lifetime of the Job. This property is populated only if the BatchJob was retrieved with an expand clause including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.

job_statistics: _models.BatchJobStatistics | None

last_modified

The last modified time of the Job. This is the last time at which the Job level data, such as the Job state or priority, changed. It does not factor in task-level changes such as adding new Tasks or Tasks changing state. Required.

last_modified: datetime

max_parallel_tasks

The maximum number of tasks that can be executed in parallel for the job. (This property is not available by default. Please contact support for more information) The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.

max_parallel_tasks: int | None

metadata

A list of name-value pairs associated with the Job as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code.

metadata: list['_models.BatchMetadataItem'] | None

network_configuration

(This property is not available by default. Please contact support for more information) The network configuration for the Job.

network_configuration: _models.BatchJobNetworkConfiguration | None

pool_info

The Pool settings associated with the Job. Required.

pool_info: _models.BatchPoolInfo

previous_state

The previous state of the Job. This property is not set if the Job is in its initial Active state. Known values are: "active", "disabling", "disabled", "enabling", "terminating", "completed", and "deleting".

previous_state: str | _models.BatchJobState | None

previous_state_transition_time

The time at which the Job entered its previous state. This property is not set if the Job is in its initial Active state.

previous_state_transition_time: datetime | None

priority

The priority of the Job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.

priority: int | None

state

"active", "disabling", "disabled", "enabling", "terminating", "completed", and "deleting".

state: str | _models.BatchJobState

state_transition_time

The time at which the Job entered its current state. Required.

state_transition_time: datetime

task_failure_mode

The action the Batch service should take when any Task in the Job fails. A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. Known values are: "noaction" and "performexitoptionsjobaction".

task_failure_mode: str | _models.BatchTaskFailureMode | None

url

The URL of the Job. Required.

url: str

uses_task_dependencies

Whether Tasks in the Job can define dependencies on each other. The default is false.

uses_task_dependencies: bool | None