CloudJob Class

An Azure Batch Job.

Inheritance
msrest.serialization.Model
CloudJob

Constructor

CloudJob(*, id: str = None, display_name: str = None, uses_task_dependencies: bool = None, url: str = None, e_tag: str = None, last_modified=None, creation_time=None, state=None, state_transition_time=None, previous_state=None, previous_state_transition_time=None, priority: int = None, allow_task_preemption: bool = None, max_parallel_tasks: int = -1, constraints=None, job_manager_task=None, job_preparation_task=None, job_release_task=None, common_environment_settings=None, pool_info=None, on_all_tasks_complete=None, on_task_failure=None, network_configuration=None, metadata=None, execution_info=None, stats=None, **kwargs)

Parameters

Name Description
id
Required
str

The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case).

display_name
Required
str
uses_task_dependencies
Required

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

url
Required
str
e_tag
Required
str

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.

last_modified
Required

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.

creation_time
Required
state
Required

The current state of the Job. Possible values include: 'active', 'disabling', 'disabled', 'enabling', 'terminating', 'completed', 'deleting'

state_transition_time
Required
previous_state
Required

The previous state of the Job. This property is not set if the Job is in its initial Active state. Possible values include: 'active', 'disabling', 'disabled', 'enabling', 'terminating', 'completed', 'deleting'

previous_state_transition_time
Required

This property is not set if the Job is in its initial Active state.

priority
Required
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
Required

Whether Tasks in this job can be preempted by other high priority jobs. 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
Required
int

The maximum number of tasks that can be executed in parallel for the job. 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. Default value: -1 .

constraints
Required

The execution constraints for the Job.

job_manager_task
Required

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

job_preparation_task
Required

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
Required

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
Required

Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value.

pool_info
Required

The Pool settings associated with the Job.

on_all_tasks_complete
Required

The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. Possible values include: 'noAction', 'terminateJob'

on_task_failure
Required

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. Possible values include: 'noAction', 'performExitOptionsJobAction'

network_configuration
Required

The network configuration for the Job.

metadata
Required

The Batch service does not assign any meaning to metadata; it is solely for the use of user code.

execution_info
Required

The execution information for the Job.

stats
Required

Resource usage statistics for the entire lifetime of the Job. This property is populated only if the CloudJob 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.

Keyword-Only Parameters

Name Description
id
Required
display_name
Required
uses_task_dependencies
Required
url
Required
e_tag
Required
last_modified
Required
creation_time
Required
state
Required
state_transition_time
Required
previous_state
Required
previous_state_transition_time
Required
priority
Required
allow_task_preemption
Required
max_parallel_tasks
default value: -1
constraints
Required
job_manager_task
Required
job_preparation_task
Required
job_release_task
Required
common_environment_settings
Required
pool_info
Required
on_all_tasks_complete
Required
on_task_failure
Required
network_configuration
Required
metadata
Required
execution_info
Required
stats
Required

Methods

as_dict

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains 'type' with the msrest type and 'key' with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

deserialize

Parse a str using the RestAPI syntax and return a model.

enable_additional_properties_sending
from_dict

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

is_xml_model
serialize

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

validate

Validate this model recursively and return a list of ValidationError.

as_dict

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains 'type' with the msrest type and 'key' with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Parameters

Name Description
key_transformer
<xref:function>

A key transformer function.

keep_readonly
default value: True

Returns

Type Description

A dict JSON compatible object

deserialize

Parse a str using the RestAPI syntax and return a model.

deserialize(data, content_type=None)

Parameters

Name Description
data
Required
str

A str using RestAPI structure. JSON by default.

content_type
str

JSON by default, set application/xml if XML.

default value: None

Returns

Type Description

An instance of this model

Exceptions

Type Description
DeserializationError if something went wrong

enable_additional_properties_sending

enable_additional_properties_sending()

from_dict

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

from_dict(data, key_extractors=None, content_type=None)

Parameters

Name Description
data
Required

A dict using RestAPI structure

content_type
str

JSON by default, set application/xml if XML.

default value: None
key_extractors
default value: None

Returns

Type Description

An instance of this model

Exceptions

Type Description
DeserializationError if something went wrong

is_xml_model

is_xml_model()

serialize

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

serialize(keep_readonly=False, **kwargs)

Parameters

Name Description
keep_readonly

If you want to serialize the readonly attributes

default value: False

Returns

Type Description

A dict JSON compatible object

validate

Validate this model recursively and return a list of ValidationError.

validate()

Returns

Type Description

A list of validation error