azure.batch.operations package

class azure.batch.operations.ApplicationOperations(client, config, serializer, deserializer)[source]

ApplicationOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

get(application_id, application_get_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets information about the specified Application.

This operation returns only Applications and versions that are available for use on Compute Nodes; that is, that can be used in an Package reference. For administrator information about Applications and versions that are not yet available to Compute Nodes, use the Azure portal or the Azure Resource Manager API.

Parameters
  • application_id (str) – The ID of the Application.

  • application_get_options (ApplicationGetOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

ApplicationSummary or ClientRawResponse if raw=true

Return type

ApplicationSummary or ClientRawResponse

Raises

BatchErrorException

list(application_list_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all of the applications available in the specified Account.

This operation returns only Applications and versions that are available for use on Compute Nodes; that is, that can be used in an Package reference. For administrator information about applications and versions that are not yet available to Compute Nodes, use the Azure portal or the Azure Resource Manager API.

Parameters
  • application_list_options (ApplicationListOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of ApplicationSummary

Return type

ApplicationSummaryPaged[ApplicationSummary]

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.PoolOperations(client, config, serializer, deserializer)[source]

PoolOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

add(pool, pool_add_options=None, custom_headers=None, raw=False, **operation_config)[source]

Adds a Pool to the specified Account.

When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.

Parameters
  • pool (PoolAddParameter) – The Pool to be added.

  • pool_add_options (PoolAddOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

delete(pool_id, pool_delete_options=None, custom_headers=None, raw=False, **operation_config)[source]

Deletes a Pool from the specified Account.

When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.

Parameters
  • pool_id (str) – The ID of the Pool to delete.

  • pool_delete_options (PoolDeleteOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

disable_auto_scale(pool_id, pool_disable_auto_scale_options=None, custom_headers=None, raw=False, **operation_config)[source]

Disables automatic scaling for a Pool.

Parameters
  • pool_id (str) – The ID of the Pool on which to disable automatic scaling.

  • pool_disable_auto_scale_options (PoolDisableAutoScaleOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

enable_auto_scale(pool_id, auto_scale_formula=None, auto_scale_evaluation_interval=None, pool_enable_auto_scale_options=None, custom_headers=None, raw=False, **operation_config)[source]

Enables automatic scaling for a Pool.

You cannot enable automatic scaling on a Pool if a resize operation is in progress on the Pool. If automatic scaling of the Pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the Pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same Pool more than once every 30 seconds.

Parameters
  • pool_id (str) – The ID of the Pool on which to enable automatic scaling.

  • auto_scale_formula (str) – The formula for the desired number of Compute Nodes in the Pool. The formula is checked for validity before it is applied to the Pool. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see Automatically scale Compute Nodes in an Azure Batch Pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling).

  • auto_scale_evaluation_interval (timedelta) – The time interval at which to automatically adjust the Pool size according to the autoscale formula. The default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service rejects the request with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). If you specify a new interval, then the existing autoscale evaluation schedule will be stopped and a new autoscale evaluation schedule will be started, with its starting time being the time when this request was issued.

  • pool_enable_auto_scale_options (PoolEnableAutoScaleOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

evaluate_auto_scale(pool_id, auto_scale_formula, pool_evaluate_auto_scale_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets the result of evaluating an automatic scaling formula on the Pool.

This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the Pool. The Pool must have auto scaling enabled in order to evaluate a formula.

Parameters
  • pool_id (str) – The ID of the Pool on which to evaluate the automatic scaling formula.

  • auto_scale_formula (str) – The formula for the desired number of Compute Nodes in the Pool. The formula is validated and its results calculated, but it is not applied to the Pool. To apply the formula to the Pool, ‘Enable automatic scaling on a Pool’. For more information about specifying this formula, see Automatically scale Compute Nodes in an Azure Batch Pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling).

  • pool_evaluate_auto_scale_options (PoolEvaluateAutoScaleOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

AutoScaleRun or ClientRawResponse if raw=true

Return type

AutoScaleRun or ClientRawResponse

Raises

BatchErrorException

exists(pool_id, pool_exists_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets basic properties of a Pool.

Parameters
  • pool_id (str) – The ID of the Pool to get.

  • pool_exists_options (PoolExistsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

bool or ClientRawResponse if raw=true

Return type

bool or ClientRawResponse

Raises

BatchErrorException

get(pool_id, pool_get_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets information about the specified Pool.

Parameters
  • pool_id (str) – The ID of the Pool to get.

  • pool_get_options (PoolGetOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

CloudPool or ClientRawResponse if raw=true

Return type

CloudPool or ClientRawResponse

Raises

BatchErrorException

get_all_lifetime_statistics(pool_get_all_lifetime_statistics_options=None, custom_headers=None, raw=False, **operation_config)[source]

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

Statistics are aggregated across all Pools 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.

Parameters
  • pool_get_all_lifetime_statistics_options (PoolGetAllLifetimeStatisticsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

PoolStatistics or ClientRawResponse if raw=true

Return type

PoolStatistics or ClientRawResponse

Raises

BatchErrorException

list(pool_list_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all of the Pools in the specified Account.

Parameters
  • pool_list_options (PoolListOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of CloudPool

Return type

CloudPoolPaged[CloudPool]

Raises

BatchErrorException

list_usage_metrics(pool_list_usage_metrics_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.

If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.

Parameters
  • pool_list_usage_metrics_options (PoolListUsageMetricsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of PoolUsageMetrics

Return type

PoolUsageMetricsPaged[PoolUsageMetrics]

Raises

BatchErrorException

patch(pool_id, pool_patch_parameter, pool_patch_options=None, custom_headers=None, raw=False, **operation_config)[source]

Updates the properties of the specified Pool.

This only replaces the Pool properties specified in the request. For example, if the Pool has a StartTask associated with it, and a request does not specify a StartTask element, then the Pool keeps the existing StartTask.

Parameters
  • pool_id (str) – The ID of the Pool to update.

  • pool_patch_parameter (PoolPatchParameter) – The parameters for the request.

  • pool_patch_options (PoolPatchOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

remove_nodes(pool_id, node_remove_parameter, pool_remove_nodes_options=None, custom_headers=None, raw=False, **operation_config)[source]

Removes Compute Nodes from the specified Pool.

This operation can only run when the allocation state of the Pool is steady. When this operation runs, the allocation state changes from steady to resizing.

Parameters
  • pool_id (str) – The ID of the Pool from which you want to remove Compute Nodes.

  • node_remove_parameter (NodeRemoveParameter) – The parameters for the request.

  • pool_remove_nodes_options (PoolRemoveNodesOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

resize(pool_id, pool_resize_parameter, pool_resize_options=None, custom_headers=None, raw=False, **operation_config)[source]

Changes the number of Compute Nodes that are assigned to a Pool.

You can only resize a Pool when its allocation state is steady. If the Pool is already resizing, the request fails with status code 409. When you resize a Pool, the Pool’s allocation state changes from steady to resizing. You cannot resize Pools which are configured for automatic scaling. If you try to do this, the Batch service returns an error 409. If you resize a Pool downwards, the Batch service chooses which Compute Nodes to remove. To remove specific Compute Nodes, use the Pool remove Compute Nodes API instead.

Parameters
  • pool_id (str) – The ID of the Pool to resize.

  • pool_resize_parameter (PoolResizeParameter) – The parameters for the request.

  • pool_resize_options (PoolResizeOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

stop_resize(pool_id, pool_stop_resize_options=None, custom_headers=None, raw=False, **operation_config)[source]

Stops an ongoing resize operation on the Pool.

This does not restore the Pool to its previous state before the resize operation: it only stops any further changes being made, and the Pool maintains its current state. After stopping, the Pool stabilizes at the number of Compute Nodes it was at when the stop operation was done. During the stop operation, the Pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize Pool request; this API can also be used to halt the initial sizing of the Pool when it is created.

Parameters
  • pool_id (str) – The ID of the Pool whose resizing you want to stop.

  • pool_stop_resize_options (PoolStopResizeOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

update_properties(pool_id, pool_update_properties_parameter, pool_update_properties_options=None, custom_headers=None, raw=False, **operation_config)[source]

Updates the properties of the specified Pool.

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

Parameters
  • pool_id (str) – The ID of the Pool to update.

  • pool_update_properties_parameter (PoolUpdatePropertiesParameter) – The parameters for the request.

  • pool_update_properties_options (PoolUpdatePropertiesOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.AccountOperations(client, config, serializer, deserializer)[source]

AccountOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

list_pool_node_counts(account_list_pool_node_counts_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets the number of Compute Nodes in each state, grouped by Pool.

Parameters
  • account_list_pool_node_counts_options (AccountListPoolNodeCountsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of PoolNodeCounts

Return type

PoolNodeCountsPaged[PoolNodeCounts]

Raises

BatchErrorException

list_supported_images(account_list_supported_images_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all Virtual Machine Images supported by the Azure Batch service.

Parameters
  • account_list_supported_images_options (AccountListSupportedImagesOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of ImageInformation

Return type

ImageInformationPaged[ImageInformation]

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.JobOperations(client, config, serializer, deserializer)[source]

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.

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

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

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.

Parameters
  • job (JobAddParameter) – The Job to be added.

  • job_add_options (JobAddOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

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

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.

Parameters
  • job_id (str) – The ID of the Job to delete.

  • job_delete_options (JobDeleteOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

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

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.

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

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

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

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.

Parameters
  • job_id (str) – The ID of the Job to enable.

  • job_enable_options (JobEnableOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

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

Gets information about the specified Job.

Parameters
  • job_id (str) – The ID of the Job.

  • job_get_options (JobGetOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

CloudJob or ClientRawResponse if raw=true

Return type

CloudJob or ClientRawResponse

Raises

BatchErrorException

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

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.

Parameters
  • job_get_all_lifetime_statistics_options (JobGetAllLifetimeStatisticsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

JobStatistics or ClientRawResponse if raw=true

Return type

JobStatistics or ClientRawResponse

Raises

BatchErrorException

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

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.

Parameters
  • job_id (str) – The ID of the Job.

  • job_get_task_counts_options (JobGetTaskCountsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

TaskCounts or ClientRawResponse if raw=true

Return type

TaskCounts or ClientRawResponse

Raises

BatchErrorException

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

Lists all of the Jobs in the specified Account.

Parameters
  • job_list_options (JobListOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of CloudJob

Return type

CloudJobPaged[CloudJob]

Raises

BatchErrorException

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

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

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

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of CloudJob

Return type

CloudJobPaged[CloudJob]

Raises

BatchErrorException

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

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.

Parameters
  • job_id (str) – The ID of the Job.

  • job_list_preparation_and_release_task_status_options (JobListPreparationAndReleaseTaskStatusOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of JobPreparationAndReleaseTaskExecutionInformation

Return type

JobPreparationAndReleaseTaskExecutionInformationPaged[JobPreparationAndReleaseTaskExecutionInformation]

Raises

BatchErrorException

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

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.

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

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

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

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.

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’.

  • job_terminate_options (JobTerminateOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

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

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.

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

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.CertificateOperations(client, config, serializer, deserializer)[source]

CertificateOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

add(certificate, certificate_add_options=None, custom_headers=None, raw=False, **operation_config)[source]

Adds a Certificate to the specified Account.

Parameters
  • certificate (CertificateAddParameter) – The Certificate to be added.

  • certificate_add_options (CertificateAddOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

cancel_deletion(thumbprint_algorithm, thumbprint, certificate_cancel_deletion_options=None, custom_headers=None, raw=False, **operation_config)[source]

Cancels a failed deletion of a Certificate from the specified Account.

If you try to delete a Certificate that is being used by a Pool or Compute Node, the status of the Certificate changes to deleteFailed. If you decide that you want to continue using the Certificate, you can use this operation to set the status of the Certificate back to active. If you intend to delete the Certificate, you do not need to run this operation after the deletion failed. You must make sure that the Certificate is not being used by any resources, and then you can try again to delete the Certificate.

Parameters
  • thumbprint_algorithm (str) – The algorithm used to derive the thumbprint parameter. This must be sha1.

  • thumbprint (str) – The thumbprint of the Certificate being deleted.

  • certificate_cancel_deletion_options (CertificateCancelDeletionOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

delete(thumbprint_algorithm, thumbprint, certificate_delete_options=None, custom_headers=None, raw=False, **operation_config)[source]

Deletes a Certificate from the specified Account.

You cannot delete a Certificate if a resource (Pool or Compute Node) is using it. Before you can delete a Certificate, you must therefore make sure that the Certificate is not associated with any existing Pools, the Certificate is not installed on any Nodes (even if you remove a Certificate from a Pool, it is not removed from existing Compute Nodes in that Pool until they restart), and no running Tasks depend on the Certificate. If you try to delete a Certificate that is in use, the deletion fails. The Certificate status changes to deleteFailed. You can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the Certificate.

Parameters
  • thumbprint_algorithm (str) – The algorithm used to derive the thumbprint parameter. This must be sha1.

  • thumbprint (str) – The thumbprint of the Certificate to be deleted.

  • certificate_delete_options (CertificateDeleteOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

get(thumbprint_algorithm, thumbprint, certificate_get_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets information about the specified Certificate.

Parameters
  • thumbprint_algorithm (str) – The algorithm used to derive the thumbprint parameter. This must be sha1.

  • thumbprint (str) – The thumbprint of the Certificate to get.

  • certificate_get_options (CertificateGetOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

Certificate or ClientRawResponse if raw=true

Return type

Certificate or ClientRawResponse

Raises

BatchErrorException

list(certificate_list_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all of the Certificates that have been added to the specified Account.

Parameters
  • certificate_list_options (CertificateListOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of Certificate

Return type

CertificatePaged[Certificate]

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.FileOperations(client, config, serializer, deserializer)[source]

FileOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

delete_from_compute_node(pool_id, node_id, file_path, recursive=None, file_delete_from_compute_node_options=None, custom_headers=None, raw=False, **operation_config)[source]

Deletes the specified file from the Compute Node.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node from which you want to delete the file.

  • file_path (str) – The path to the file or directory that you want to delete.

  • recursive (bool) – Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail.

  • file_delete_from_compute_node_options (FileDeleteFromComputeNodeOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

delete_from_task(job_id, task_id, file_path, recursive=None, file_delete_from_task_options=None, custom_headers=None, raw=False, **operation_config)[source]

Deletes the specified Task file from the Compute Node where the Task ran.

Parameters
  • job_id (str) – The ID of the Job that contains the Task.

  • task_id (str) – The ID of the Task whose file you want to delete.

  • file_path (str) – The path to the Task file or directory that you want to delete.

  • recursive (bool) – Whether to delete children of a directory. If the filePath parameter represents a directory instead of a file, you can set recursive to true to delete the directory and all of the files and subdirectories in it. If recursive is false then the directory must be empty or deletion will fail.

  • file_delete_from_task_options (FileDeleteFromTaskOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

get_from_compute_node(pool_id, node_id, file_path, file_get_from_compute_node_options=None, custom_headers=None, raw=False, callback=None, **operation_config)[source]

Returns the content of the specified Compute Node file.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node that contains the file.

  • file_path (str) – The path to the Compute Node file that you want to get the content of.

  • file_get_from_compute_node_options (FileGetFromComputeNodeOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • callback (Callable[Bytes, response=None]) – When specified, will be called with each chunk of data that is streamed. The callback should take two arguments, the bytes of the current chunk of data and the response object. If the data is uploading, response will be None.

  • operation_configOperation configuration overrides.

Returns

object or ClientRawResponse if raw=true

Return type

Generator or ClientRawResponse

Raises

BatchErrorException

get_from_task(job_id, task_id, file_path, file_get_from_task_options=None, custom_headers=None, raw=False, callback=None, **operation_config)[source]

Returns the content of the specified Task file.

Parameters
  • job_id (str) – The ID of the Job that contains the Task.

  • task_id (str) – The ID of the Task whose file you want to retrieve.

  • file_path (str) – The path to the Task file that you want to get the content of.

  • file_get_from_task_options (FileGetFromTaskOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • callback (Callable[Bytes, response=None]) – When specified, will be called with each chunk of data that is streamed. The callback should take two arguments, the bytes of the current chunk of data and the response object. If the data is uploading, response will be None.

  • operation_configOperation configuration overrides.

Returns

object or ClientRawResponse if raw=true

Return type

Generator or ClientRawResponse

Raises

BatchErrorException

get_properties_from_compute_node(pool_id, node_id, file_path, file_get_properties_from_compute_node_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets the properties of the specified Compute Node file.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node that contains the file.

  • file_path (str) – The path to the Compute Node file that you want to get the properties of.

  • file_get_properties_from_compute_node_options (FileGetPropertiesFromComputeNodeOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

get_properties_from_task(job_id, task_id, file_path, file_get_properties_from_task_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets the properties of the specified Task file.

Parameters
  • job_id (str) – The ID of the Job that contains the Task.

  • task_id (str) – The ID of the Task whose file you want to get the properties of.

  • file_path (str) – The path to the Task file that you want to get the properties of.

  • file_get_properties_from_task_options (FileGetPropertiesFromTaskOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

list_from_compute_node(pool_id, node_id, recursive=None, file_list_from_compute_node_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all of the files in Task directories on the specified Compute Node.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node whose files you want to list.

  • recursive (bool) – Whether to list children of a directory.

  • file_list_from_compute_node_options (FileListFromComputeNodeOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of NodeFile

Return type

NodeFilePaged[NodeFile]

Raises

BatchErrorException

list_from_task(job_id, task_id, recursive=None, file_list_from_task_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists the files in a Task’s directory on its Compute Node.

Parameters
  • job_id (str) – The ID of the Job that contains the Task.

  • task_id (str) – The ID of the Task whose files you want to list.

  • recursive (bool) – Whether to list children of the Task directory. This parameter can be used in combination with the filter parameter to list specific type of files.

  • file_list_from_task_options (FileListFromTaskOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of NodeFile

Return type

NodeFilePaged[NodeFile]

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.JobScheduleOperations(client, config, serializer, deserializer)[source]

JobScheduleOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

add(cloud_job_schedule, job_schedule_add_options=None, custom_headers=None, raw=False, **operation_config)[source]

Adds a Job Schedule to the specified Account.

Parameters
  • cloud_job_schedule (JobScheduleAddParameter) – The Job Schedule to be added.

  • job_schedule_add_options (JobScheduleAddOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

delete(job_schedule_id, job_schedule_delete_options=None, custom_headers=None, raw=False, **operation_config)[source]

Deletes a Job Schedule from the specified Account.

When you delete a Job Schedule, this also deletes all Jobs and Tasks under that schedule. When Tasks are deleted, all the files in their working directories on the Compute Nodes are also deleted (the retention period is ignored). The Job Schedule statistics are no longer accessible once the Job Schedule is deleted, though they are still counted towards Account lifetime statistics.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule to delete.

  • job_schedule_delete_options (JobScheduleDeleteOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

disable(job_schedule_id, job_schedule_disable_options=None, custom_headers=None, raw=False, **operation_config)[source]

Disables a Job Schedule.

No new Jobs will be created until the Job Schedule is enabled again.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule to disable.

  • job_schedule_disable_options (JobScheduleDisableOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

enable(job_schedule_id, job_schedule_enable_options=None, custom_headers=None, raw=False, **operation_config)[source]

Enables a Job Schedule.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule to enable.

  • job_schedule_enable_options (JobScheduleEnableOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

exists(job_schedule_id, job_schedule_exists_options=None, custom_headers=None, raw=False, **operation_config)[source]

Checks the specified Job Schedule exists.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule which you want to check.

  • job_schedule_exists_options (JobScheduleExistsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

bool or ClientRawResponse if raw=true

Return type

bool or ClientRawResponse

Raises

BatchErrorException

get(job_schedule_id, job_schedule_get_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets information about the specified Job Schedule.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule to get.

  • job_schedule_get_options (JobScheduleGetOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

CloudJobSchedule or ClientRawResponse if raw=true

Return type

CloudJobSchedule or ClientRawResponse

Raises

BatchErrorException

list(job_schedule_list_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all of the Job Schedules in the specified Account.

Parameters
  • job_schedule_list_options (JobScheduleListOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of CloudJobSchedule

Return type

CloudJobSchedulePaged[CloudJobSchedule]

Raises

BatchErrorException

patch(job_schedule_id, job_schedule_patch_parameter, job_schedule_patch_options=None, custom_headers=None, raw=False, **operation_config)[source]

Updates the properties of the specified Job Schedule.

This replaces only the Job Schedule properties specified in the request. For example, if the schedule property is not specified with this request, then the Batch service will keep 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.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule to update.

  • job_schedule_patch_parameter (JobSchedulePatchParameter) – The parameters for the request.

  • job_schedule_patch_options (JobSchedulePatchOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

terminate(job_schedule_id, job_schedule_terminate_options=None, custom_headers=None, raw=False, **operation_config)[source]

Terminates a Job Schedule.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule to terminates.

  • job_schedule_terminate_options (JobScheduleTerminateOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

update(job_schedule_id, job_schedule_update_parameter, job_schedule_update_options=None, custom_headers=None, raw=False, **operation_config)[source]

Updates the properties of the specified Job Schedule.

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.

Parameters
  • job_schedule_id (str) – The ID of the Job Schedule to update.

  • job_schedule_update_parameter (JobScheduleUpdateParameter) – The parameters for the request.

  • job_schedule_update_options (JobScheduleUpdateOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.TaskOperations(client, config, serializer, deserializer)[source]

TaskOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

add(job_id, task, task_add_options=None, custom_headers=None, raw=False, **operation_config)[source]

Adds a Task to the specified Job.

The maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.

Parameters
  • job_id (str) – The ID of the Job to which the Task is to be added.

  • task (TaskAddParameter) – The Task to be added.

  • task_add_options (TaskAddOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

add_collection(job_id, value, task_add_collection_options=None, custom_headers=None, raw=False, threads=0, **operation_config)

Adds a collection of tasks to the specified job.

Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.

Parameters
  • job_id (str) – The ID of the job to which the task collection is to be added.

  • value (list of TaskAddParameter) – The collection of tasks to add. The total serialized size of this collection must be less than 4MB. If it is greater than 4MB (for example if each task has 100’s of resource files or environment variables), the request will fail with code ‘RequestBodyTooLarge’ and should be retried again with fewer tasks.

  • task_add_collection_options (TaskAddCollectionOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • threads (int) – number of threads to use in parallel when adding tasks. If specified and greater than 0, will start additional threads to submit requests and wait for them to finish. Otherwise will submit add_collection requests sequentially on main thread

Returns

TaskAddCollectionResult or ClientRawResponse if raw=true

Return type

TaskAddCollectionResult or ClientRawResponse

Raises

CreateTasksErrorException

delete(job_id, task_id, task_delete_options=None, custom_headers=None, raw=False, **operation_config)[source]

Deletes a Task from the specified Job.

When a Task is deleted, all of the files in its directory on the Compute Node where it ran are also deleted (regardless of the retention time). For multi-instance Tasks, the delete Task operation applies synchronously to the primary task; subtasks and their files are then deleted asynchronously in the background.

Parameters
  • job_id (str) – The ID of the Job from which to delete the Task.

  • task_id (str) – The ID of the Task to delete.

  • task_delete_options (TaskDeleteOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

get(job_id, task_id, task_get_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets information about the specified Task.

For multi-instance Tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary Task. Use the list subtasks API to retrieve information about subtasks.

Parameters
  • job_id (str) – The ID of the Job that contains the Task.

  • task_id (str) – The ID of the Task to get information about.

  • task_get_options (TaskGetOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

CloudTask or ClientRawResponse if raw=true

Return type

CloudTask or ClientRawResponse

Raises

BatchErrorException

list(job_id, task_list_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all of the Tasks that are associated with the specified Job.

For multi-instance Tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary Task. Use the list subtasks API to retrieve information about subtasks.

Parameters
  • job_id (str) – The ID of the Job.

  • task_list_options (TaskListOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of CloudTask

Return type

CloudTaskPaged[CloudTask]

Raises

BatchErrorException

list_subtasks(job_id, task_id, task_list_subtasks_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists all of the subtasks that are associated with the specified multi-instance Task.

If the Task is not a multi-instance Task then this returns an empty collection.

Parameters
  • job_id (str) – The ID of the Job.

  • task_id (str) – The ID of the Task.

  • task_list_subtasks_options (TaskListSubtasksOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

CloudTaskListSubtasksResult or ClientRawResponse if raw=true

Return type

CloudTaskListSubtasksResult or ClientRawResponse

Raises

BatchErrorException

reactivate(job_id, task_id, task_reactivate_options=None, custom_headers=None, raw=False, **operation_config)[source]

Reactivates a Task, allowing it to run again even if its retry count has been exhausted.

Reactivation makes a Task eligible to be retried again up to its maximum retry count. The Task’s state is changed to active. As the Task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a Task is reactivated, its retry count is reset to 0. Reactivation will fail for Tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the Job has completed (or is terminating or deleting).

Parameters
  • job_id (str) – The ID of the Job containing the Task.

  • task_id (str) – The ID of the Task to reactivate.

  • task_reactivate_options (TaskReactivateOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

terminate(job_id, task_id, task_terminate_options=None, custom_headers=None, raw=False, **operation_config)[source]

Terminates the specified Task.

When the Task has been terminated, it moves to the completed state. For multi-instance Tasks, the terminate Task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in the background.

Parameters
  • job_id (str) – The ID of the Job containing the Task.

  • task_id (str) – The ID of the Task to terminate.

  • task_terminate_options (TaskTerminateOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

update(job_id, task_id, constraints=None, task_update_options=None, custom_headers=None, raw=False, **operation_config)[source]

Updates the properties of the specified Task.

Parameters
  • job_id (str) – The ID of the Job containing the Task.

  • task_id (str) – The ID of the Task to update.

  • constraints (TaskConstraints) – Constraints that apply to this Task. If omitted, the Task is given the default constraints. For multi-instance Tasks, updating the retention time applies only to the primary Task and not subtasks.

  • task_update_options (TaskUpdateOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>
class azure.batch.operations.ComputeNodeOperations(client, config, serializer, deserializer)[source]

ComputeNodeOperations operations.

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

Parameters
  • client – Client for service requests.

  • config – Configuration of service client.

  • serializer – An object model serializer.

  • deserializer – An object model deserializer.

Variables

api_version – Client API Version. Constant value: “2020-03-01.11.0”.

add_user(pool_id, node_id, user, compute_node_add_user_options=None, custom_headers=None, raw=False, **operation_config)[source]

Adds a user Account to the specified Compute Node.

You can add a user Account to a Compute Node only when it is in the idle or running state.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the machine on which you want to create a user Account.

  • user (ComputeNodeUser) – The user Account to be created.

  • compute_node_add_user_options (ComputeNodeAddUserOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

delete_user(pool_id, node_id, user_name, compute_node_delete_user_options=None, custom_headers=None, raw=False, **operation_config)[source]

Deletes a user Account from the specified Compute Node.

You can delete a user Account to a Compute Node only when it is in the idle or running state.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the machine on which you want to delete a user Account.

  • user_name (str) – The name of the user Account to delete.

  • compute_node_delete_user_options (ComputeNodeDeleteUserOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

disable_scheduling(pool_id, node_id, node_disable_scheduling_option=None, compute_node_disable_scheduling_options=None, custom_headers=None, raw=False, **operation_config)[source]

Disables Task scheduling on the specified Compute Node.

You can disable Task scheduling on a Compute Node only if its current scheduling state is enabled.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node on which you want to disable Task scheduling.

  • node_disable_scheduling_option (str or DisableComputeNodeSchedulingOption) – What to do with currently running Tasks when disabling Task scheduling on the Compute Node. The default value is requeue. Possible values include: ‘requeue’, ‘terminate’, ‘taskCompletion’

  • compute_node_disable_scheduling_options (ComputeNodeDisableSchedulingOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

enable_scheduling(pool_id, node_id, compute_node_enable_scheduling_options=None, custom_headers=None, raw=False, **operation_config)[source]

Enables Task scheduling on the specified Compute Node.

You can enable Task scheduling on a Compute Node only if its current scheduling state is disabled.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node on which you want to enable Task scheduling.

  • compute_node_enable_scheduling_options (ComputeNodeEnableSchedulingOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

get(pool_id, node_id, compute_node_get_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets information about the specified Compute Node.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node that you want to get information about.

  • compute_node_get_options (ComputeNodeGetOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

ComputeNode or ClientRawResponse if raw=true

Return type

ComputeNode or ClientRawResponse

Raises

BatchErrorException

get_remote_desktop(pool_id, node_id, compute_node_get_remote_desktop_options=None, custom_headers=None, raw=False, callback=None, **operation_config)[source]

Gets the Remote Desktop Protocol file for the specified Compute Node.

Before you can access a Compute Node by using the RDP file, you must create a user Account on the Compute Node. This API can only be invoked on Pools created with a cloud service configuration. For Pools created with a virtual machine configuration, see the GetRemoteLoginSettings API.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node for which you want to get the Remote Desktop Protocol file.

  • compute_node_get_remote_desktop_options (ComputeNodeGetRemoteDesktopOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • callback (Callable[Bytes, response=None]) – When specified, will be called with each chunk of data that is streamed. The callback should take two arguments, the bytes of the current chunk of data and the response object. If the data is uploading, response will be None.

  • operation_configOperation configuration overrides.

Returns

object or ClientRawResponse if raw=true

Return type

Generator or ClientRawResponse

Raises

BatchErrorException

get_remote_login_settings(pool_id, node_id, compute_node_get_remote_login_settings_options=None, custom_headers=None, raw=False, **operation_config)[source]

Gets the settings required for remote login to a Compute Node.

Before you can remotely login to a Compute Node using the remote login settings, you must create a user Account on the Compute Node. This API can be invoked only on Pools created with the virtual machine configuration property. For Pools created with a cloud service configuration, see the GetRemoteDesktop API.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node for which to obtain the remote login settings.

  • compute_node_get_remote_login_settings_options (ComputeNodeGetRemoteLoginSettingsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

ComputeNodeGetRemoteLoginSettingsResult or ClientRawResponse if raw=true

Return type

ComputeNodeGetRemoteLoginSettingsResult or ClientRawResponse

Raises

BatchErrorException

list(pool_id, compute_node_list_options=None, custom_headers=None, raw=False, **operation_config)[source]

Lists the Compute Nodes in the specified Pool.

Parameters
  • pool_id (str) – The ID of the Pool from which you want to list Compute Nodes.

  • compute_node_list_options (ComputeNodeListOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

An iterator like instance of ComputeNode

Return type

ComputeNodePaged[ComputeNode]

Raises

BatchErrorException

reboot(pool_id, node_id, node_reboot_option=None, compute_node_reboot_options=None, custom_headers=None, raw=False, **operation_config)[source]

Restarts the specified Compute Node.

You can restart a Compute Node only if it is in an idle or running state.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node that you want to restart.

  • node_reboot_option (str or ComputeNodeRebootOption) – When to reboot the Compute Node and what to do with currently running Tasks. The default value is requeue. Possible values include: ‘requeue’, ‘terminate’, ‘taskCompletion’, ‘retainedData’

  • compute_node_reboot_options (ComputeNodeRebootOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

reimage(pool_id, node_id, node_reimage_option=None, compute_node_reimage_options=None, custom_headers=None, raw=False, **operation_config)[source]

Reinstalls the operating system on the specified Compute Node.

You can reinstall the operating system on a Compute Node only if it is in an idle or running state. This API can be invoked only on Pools created with the cloud service configuration property.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node that you want to restart.

  • node_reimage_option (str or ComputeNodeReimageOption) – When to reimage the Compute Node and what to do with currently running Tasks. The default value is requeue. Possible values include: ‘requeue’, ‘terminate’, ‘taskCompletion’, ‘retainedData’

  • compute_node_reimage_options (ComputeNodeReimageOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

update_user(pool_id, node_id, user_name, node_update_user_parameter, compute_node_update_user_options=None, custom_headers=None, raw=False, **operation_config)[source]

Updates the password and expiration time of a user Account on the specified Compute Node.

This operation replaces of all the updatable properties of the Account. For example, if the expiryTime element is not specified, the current value is replaced with the default value, not left unmodified. You can update a user Account on a Compute Node only when it is in the idle or running state.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the machine on which you want to update a user Account.

  • user_name (str) – The name of the user Account to update.

  • node_update_user_parameter (NodeUpdateUserParameter) – The parameters for the request.

  • compute_node_update_user_options (ComputeNodeUpdateUserOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

None or ClientRawResponse if raw=true

Return type

None or ClientRawResponse

Raises

BatchErrorException

upload_batch_service_logs(pool_id, node_id, upload_batch_service_logs_configuration, compute_node_upload_batch_service_logs_options=None, custom_headers=None, raw=False, **operation_config)[source]

Upload Azure Batch service log files from the specified Compute Node to Azure Blob Storage.

This is for gathering Azure Batch service log files in an automated fashion from Compute Nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service.

Parameters
  • pool_id (str) – The ID of the Pool that contains the Compute Node.

  • node_id (str) – The ID of the Compute Node from which you want to upload the Azure Batch service log files.

  • upload_batch_service_logs_configuration (UploadBatchServiceLogsConfiguration) – The Azure Batch service log files upload configuration.

  • compute_node_upload_batch_service_logs_options (ComputeNodeUploadBatchServiceLogsOptions) – Additional parameters for the operation

  • custom_headers (dict) – headers that will be added to the request

  • raw (bool) – returns the direct response alongside the deserialized response

  • operation_configOperation configuration overrides.

Returns

UploadBatchServiceLogsResult or ClientRawResponse if raw=true

Return type

UploadBatchServiceLogsResult or ClientRawResponse

Raises

BatchErrorException

models = <module 'azure.batch.models' from '/home/vsts/work/1/s/sdk/batch/azure-batch/.tox/sphinx/lib/python3.6/site-packages/azure/batch/models/__init__.py'>