Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions azure-batch/azure/batch/batch_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,26 @@ class BatchServiceClientConfiguration(AzureConfiguration):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
:param batch_url: The base URL for all Azure Batch service requests.
:type batch_url: str
"""

def __init__(
self, credentials, base_url=None):
self, credentials, batch_url):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if not base_url:
base_url = 'https://batch.core.windows.net'
if batch_url is None:
raise ValueError("Parameter 'batch_url' must not be None.")
base_url = '{batchUrl}'

super(BatchServiceClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-batch/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.batch_url = batch_url


class BatchServiceClient(SDKClient):
Expand Down Expand Up @@ -80,17 +83,18 @@ class BatchServiceClient(SDKClient):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
:param batch_url: The base URL for all Azure Batch service requests.
:type batch_url: str
"""

def __init__(
self, credentials, base_url=None):
self, credentials, batch_url):

self.config = BatchServiceClientConfiguration(credentials, base_url)
self.config = BatchServiceClientConfiguration(credentials, batch_url)
super(BatchServiceClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-08-01.7.0'
self.api_version = '2018-12-01.8.0'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand Down
19 changes: 10 additions & 9 deletions azure-batch/azure/batch/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from .node_file_py3 import NodeFile
from .schedule_py3 import Schedule
from .job_constraints_py3 import JobConstraints
from .job_network_configuration_py3 import JobNetworkConfiguration
from .container_registry_py3 import ContainerRegistry
from .task_container_settings_py3 import TaskContainerSettings
from .resource_file_py3 import ResourceFile
Expand All @@ -39,6 +40,7 @@
from .auto_user_specification_py3 import AutoUserSpecification
from .user_identity_py3 import UserIdentity
from .linux_user_configuration_py3 import LinuxUserConfiguration
from .windows_user_configuration_py3 import WindowsUserConfiguration
from .user_account_py3 import UserAccount
from .task_constraints_py3 import TaskConstraints
from .output_file_blob_container_destination_py3 import OutputFileBlobContainerDestination
Expand All @@ -53,7 +55,6 @@
from .certificate_reference_py3 import CertificateReference
from .metadata_item_py3 import MetadataItem
from .cloud_service_configuration_py3 import CloudServiceConfiguration
from .os_disk_py3 import OSDisk
from .windows_configuration_py3 import WindowsConfiguration
from .data_disk_py3 import DataDisk
from .container_configuration_py3 import ContainerConfiguration
Expand Down Expand Up @@ -122,7 +123,6 @@
from .pool_evaluate_auto_scale_parameter_py3 import PoolEvaluateAutoScaleParameter
from .pool_resize_parameter_py3 import PoolResizeParameter
from .pool_update_properties_parameter_py3 import PoolUpdatePropertiesParameter
from .pool_upgrade_os_parameter_py3 import PoolUpgradeOSParameter
from .pool_patch_parameter_py3 import PoolPatchParameter
from .task_update_parameter_py3 import TaskUpdateParameter
from .node_update_user_parameter_py3 import NodeUpdateUserParameter
Expand Down Expand Up @@ -150,7 +150,6 @@
from .pool_resize_options_py3 import PoolResizeOptions
from .pool_stop_resize_options_py3 import PoolStopResizeOptions
from .pool_update_properties_options_py3 import PoolUpdatePropertiesOptions
from .pool_upgrade_os_options_py3 import PoolUpgradeOsOptions
from .pool_remove_nodes_options_py3 import PoolRemoveNodesOptions
from .account_list_node_agent_skus_options_py3 import AccountListNodeAgentSkusOptions
from .account_list_pool_node_counts_options_py3 import AccountListPoolNodeCountsOptions
Expand Down Expand Up @@ -230,6 +229,7 @@
from .node_file import NodeFile
from .schedule import Schedule
from .job_constraints import JobConstraints
from .job_network_configuration import JobNetworkConfiguration
from .container_registry import ContainerRegistry
from .task_container_settings import TaskContainerSettings
from .resource_file import ResourceFile
Expand All @@ -241,6 +241,7 @@
from .auto_user_specification import AutoUserSpecification
from .user_identity import UserIdentity
from .linux_user_configuration import LinuxUserConfiguration
from .windows_user_configuration import WindowsUserConfiguration
from .user_account import UserAccount
from .task_constraints import TaskConstraints
from .output_file_blob_container_destination import OutputFileBlobContainerDestination
Expand All @@ -255,7 +256,6 @@
from .certificate_reference import CertificateReference
from .metadata_item import MetadataItem
from .cloud_service_configuration import CloudServiceConfiguration
from .os_disk import OSDisk
from .windows_configuration import WindowsConfiguration
from .data_disk import DataDisk
from .container_configuration import ContainerConfiguration
Expand Down Expand Up @@ -324,7 +324,6 @@
from .pool_evaluate_auto_scale_parameter import PoolEvaluateAutoScaleParameter
from .pool_resize_parameter import PoolResizeParameter
from .pool_update_properties_parameter import PoolUpdatePropertiesParameter
from .pool_upgrade_os_parameter import PoolUpgradeOSParameter
from .pool_patch_parameter import PoolPatchParameter
from .task_update_parameter import TaskUpdateParameter
from .node_update_user_parameter import NodeUpdateUserParameter
Expand Down Expand Up @@ -352,7 +351,6 @@
from .pool_resize_options import PoolResizeOptions
from .pool_stop_resize_options import PoolStopResizeOptions
from .pool_update_properties_options import PoolUpdatePropertiesOptions
from .pool_upgrade_os_options import PoolUpgradeOsOptions
from .pool_remove_nodes_options import PoolRemoveNodesOptions
from .account_list_node_agent_skus_options import AccountListNodeAgentSkusOptions
from .account_list_pool_node_counts_options import AccountListPoolNodeCountsOptions
Expand Down Expand Up @@ -434,12 +432,14 @@
DependencyAction,
AutoUserScope,
ElevationLevel,
LoginMode,
OutputFileUploadCondition,
ComputeNodeFillType,
CertificateStoreLocation,
CertificateVisibility,
CachingType,
StorageAccountType,
DynamicVNetAssignmentScope,
InboundEndpointProtocol,
NetworkSecurityGroupRuleAccess,
PoolLifetimeOption,
Expand Down Expand Up @@ -485,6 +485,7 @@
'NodeFile',
'Schedule',
'JobConstraints',
'JobNetworkConfiguration',
'ContainerRegistry',
'TaskContainerSettings',
'ResourceFile',
Expand All @@ -496,6 +497,7 @@
'AutoUserSpecification',
'UserIdentity',
'LinuxUserConfiguration',
'WindowsUserConfiguration',
'UserAccount',
'TaskConstraints',
'OutputFileBlobContainerDestination',
Expand All @@ -510,7 +512,6 @@
'CertificateReference',
'MetadataItem',
'CloudServiceConfiguration',
'OSDisk',
'WindowsConfiguration',
'DataDisk',
'ContainerConfiguration',
Expand Down Expand Up @@ -579,7 +580,6 @@
'PoolEvaluateAutoScaleParameter',
'PoolResizeParameter',
'PoolUpdatePropertiesParameter',
'PoolUpgradeOSParameter',
'PoolPatchParameter',
'TaskUpdateParameter',
'NodeUpdateUserParameter',
Expand Down Expand Up @@ -607,7 +607,6 @@
'PoolResizeOptions',
'PoolStopResizeOptions',
'PoolUpdatePropertiesOptions',
'PoolUpgradeOsOptions',
'PoolRemoveNodesOptions',
'AccountListNodeAgentSkusOptions',
'AccountListPoolNodeCountsOptions',
Expand Down Expand Up @@ -688,12 +687,14 @@
'DependencyAction',
'AutoUserScope',
'ElevationLevel',
'LoginMode',
'OutputFileUploadCondition',
'ComputeNodeFillType',
'CertificateStoreLocation',
'CertificateVisibility',
'CachingType',
'StorageAccountType',
'DynamicVNetAssignmentScope',
'InboundEndpointProtocol',
'NetworkSecurityGroupRuleAccess',
'PoolLifetimeOption',
Expand Down
15 changes: 13 additions & 2 deletions azure-batch/azure/batch/models/batch_service_client_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ class ElevationLevel(str, Enum):
admin = "admin" #: The user is a user with elevated access and operates with full Administrator permissions.


class LoginMode(str, Enum):

batch = "batch" #: The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running parallel processes.
interactive = "interactive" #: The LOGON32_LOGON_INTERACTIVE Win32 login mode. UAC is enabled on Windows VirtualMachineConfiguration pools. If this option is used with an elevated user identity in a Windows VirtualMachineConfiguration pool, the user session will not be elevated unless the application executed by the task command line is configured to always require administrative privilege or to always require maximum privilege.


class OutputFileUploadCondition(str, Enum):

task_success = "tasksuccess" #: Upload the file(s) only after the task process exits with an exit code of 0.
Expand Down Expand Up @@ -100,6 +106,12 @@ class StorageAccountType(str, Enum):
premium_lrs = "premium_lrs" #: The data disk should use premium locally redundant storage.


class DynamicVNetAssignmentScope(str, Enum):

none = "none" #: No dynamic VNet assignment is enabled.
job = "job" #: Dynamic VNet assignment is done per-job.


class InboundEndpointProtocol(str, Enum):

tcp = "tcp" #: Use TCP for the endpoint.
Expand Down Expand Up @@ -178,7 +190,6 @@ class PoolState(str, Enum):

active = "active" #: The pool is available to run tasks subject to the availability of compute nodes.
deleting = "deleting" #: The user has requested that the pool be deleted, but the delete operation has not yet completed.
upgrading = "upgrading" #: The user has requested that the operating system of the pool's nodes be upgraded, but the upgrade operation has not yet completed (that is, some nodes in the pool have not yet been upgraded). While upgrading, the pool may be able to run tasks (with reduced capacity) but this is not guaranteed.


class AllocationState(str, Enum):
Expand Down Expand Up @@ -230,7 +241,7 @@ class ComputeNodeState(str, Enum):
unknown = "unknown" #: The Batch service has lost contact with the node, and does not know its true state.
leaving_pool = "leavingpool" #: The node is leaving the pool, either because the user explicitly removed it or because the pool is resizing or autoscaling down.
offline = "offline" #: The node is not currently running a task, and scheduling of new tasks to the node is disabled.
preempted = "preempted" #: The low-priority node has been preempted. Tasks which were running on the node when it was preempted will be rescheduled when another node becomes available.
preempted = "preempted" #: The low-priority node has been preempted. Tasks which were running on the node when it was pre-empted will be rescheduled when another node becomes available.


class SchedulingState(str, Enum):
Expand Down
4 changes: 4 additions & 0 deletions azure-batch/azure/batch/models/cloud_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class CloudJob(Model):
default is noaction. Possible values include: 'noAction',
'performExitOptionsJobAction'
:type on_task_failure: str or ~azure.batch.models.OnTaskFailure
:param network_configuration: The network configuration for the job.
:type network_configuration: ~azure.batch.models.JobNetworkConfiguration
:param metadata: A list of name-value pairs associated with the job as
metadata. The Batch service does not assign any meaning to metadata; it is
solely for the use of user code.
Expand Down Expand Up @@ -126,6 +128,7 @@ class CloudJob(Model):
'pool_info': {'key': 'poolInfo', 'type': 'PoolInformation'},
'on_all_tasks_complete': {'key': 'onAllTasksComplete', 'type': 'OnAllTasksComplete'},
'on_task_failure': {'key': 'onTaskFailure', 'type': 'OnTaskFailure'},
'network_configuration': {'key': 'networkConfiguration', 'type': 'JobNetworkConfiguration'},
'metadata': {'key': 'metadata', 'type': '[MetadataItem]'},
'execution_info': {'key': 'executionInfo', 'type': 'JobExecutionInformation'},
'stats': {'key': 'stats', 'type': 'JobStatistics'},
Expand Down Expand Up @@ -153,6 +156,7 @@ def __init__(self, **kwargs):
self.pool_info = kwargs.get('pool_info', None)
self.on_all_tasks_complete = kwargs.get('on_all_tasks_complete', None)
self.on_task_failure = kwargs.get('on_task_failure', None)
self.network_configuration = kwargs.get('network_configuration', None)
self.metadata = kwargs.get('metadata', None)
self.execution_info = kwargs.get('execution_info', None)
self.stats = kwargs.get('stats', None)
6 changes: 5 additions & 1 deletion azure-batch/azure/batch/models/cloud_job_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class CloudJob(Model):
default is noaction. Possible values include: 'noAction',
'performExitOptionsJobAction'
:type on_task_failure: str or ~azure.batch.models.OnTaskFailure
:param network_configuration: The network configuration for the job.
:type network_configuration: ~azure.batch.models.JobNetworkConfiguration
:param metadata: A list of name-value pairs associated with the job as
metadata. The Batch service does not assign any meaning to metadata; it is
solely for the use of user code.
Expand Down Expand Up @@ -126,12 +128,13 @@ class CloudJob(Model):
'pool_info': {'key': 'poolInfo', 'type': 'PoolInformation'},
'on_all_tasks_complete': {'key': 'onAllTasksComplete', 'type': 'OnAllTasksComplete'},
'on_task_failure': {'key': 'onTaskFailure', 'type': 'OnTaskFailure'},
'network_configuration': {'key': 'networkConfiguration', 'type': 'JobNetworkConfiguration'},
'metadata': {'key': 'metadata', 'type': '[MetadataItem]'},
'execution_info': {'key': 'executionInfo', 'type': 'JobExecutionInformation'},
'stats': {'key': 'stats', 'type': 'JobStatistics'},
}

def __init__(self, *, 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, 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, metadata=None, execution_info=None, stats=None, **kwargs) -> None:
def __init__(self, *, 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, 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) -> None:
super(CloudJob, self).__init__(**kwargs)
self.id = id
self.display_name = display_name
Expand All @@ -153,6 +156,7 @@ def __init__(self, *, id: str=None, display_name: str=None, uses_task_dependenci
self.pool_info = pool_info
self.on_all_tasks_complete = on_all_tasks_complete
self.on_task_failure = on_task_failure
self.network_configuration = network_configuration
self.metadata = metadata
self.execution_info = execution_info
self.stats = stats
2 changes: 1 addition & 1 deletion azure-batch/azure/batch/models/cloud_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CloudPool(Model):
:param creation_time: The creation time of the pool.
:type creation_time: datetime
:param state: The current state of the pool. Possible values include:
'active', 'deleting', 'upgrading'
'active', 'deleting'
:type state: str or ~azure.batch.models.PoolState
:param state_transition_time: The time at which the pool entered its
current state.
Expand Down
2 changes: 1 addition & 1 deletion azure-batch/azure/batch/models/cloud_pool_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CloudPool(Model):
:param creation_time: The creation time of the pool.
:type creation_time: datetime
:param state: The current state of the pool. Possible values include:
'active', 'deleting', 'upgrading'
'active', 'deleting'
:type state: str or ~azure.batch.models.PoolState
:param state_transition_time: The time at which the pool entered its
current state.
Expand Down
25 changes: 6 additions & 19 deletions azure-batch/azure/batch/models/cloud_service_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class CloudServiceConfiguration(Model):
"""The configuration for nodes in a pool based on the Azure Cloud Services
platform.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:param os_family: Required. The Azure Guest OS family to be installed on
Expand All @@ -30,32 +27,22 @@ class CloudServiceConfiguration(Model):
see Azure Guest OS Releases
(https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases).
:type os_family: str
:param target_os_version: The Azure Guest OS version to be installed on
the virtual machines in the pool. The default value is * which specifies
the latest operating system version for the specified OS family.
:type target_os_version: str
:ivar current_os_version: The Azure Guest OS Version currently installed
on the virtual machines in the pool. This may differ from targetOSVersion
if the pool state is Upgrading. In this case some virtual machines may be
on the targetOSVersion and some may be on the currentOSVersion during the
upgrade process. Once all virtual machines have upgraded, currentOSVersion
is updated to be the same as targetOSVersion.
:vartype current_os_version: str
:param os_version: The Azure Guest OS version to be installed on the
virtual machines in the pool. The default value is * which specifies the
latest operating system version for the specified OS family.
:type os_version: str
"""

_validation = {
'os_family': {'required': True},
'current_os_version': {'readonly': True},
}

_attribute_map = {
'os_family': {'key': 'osFamily', 'type': 'str'},
'target_os_version': {'key': 'targetOSVersion', 'type': 'str'},
'current_os_version': {'key': 'currentOSVersion', 'type': 'str'},
'os_version': {'key': 'osVersion', 'type': 'str'},
}

def __init__(self, **kwargs):
super(CloudServiceConfiguration, self).__init__(**kwargs)
self.os_family = kwargs.get('os_family', None)
self.target_os_version = kwargs.get('target_os_version', None)
self.current_os_version = None
self.os_version = kwargs.get('os_version', None)
Loading