Skip to content

Commit

Permalink
API update (#121)
Browse files Browse the repository at this point in the history
* AAPI update

* Update CLI
  • Loading branch information
bgklein authored Jun 15, 2020
2 parents 9c9e762 + df84dd5 commit bce284a
Show file tree
Hide file tree
Showing 12 changed files with 5,539 additions and 7,418 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SDK Release History
===================

8.0.0 (2020-06-15)
------------------

* Update to match latest Python SDK taking associated breaking changes.

7.0.0 (2019-08-20)
------------------

Expand Down
6 changes: 1 addition & 5 deletions azext/batch/_file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,7 @@ def resolve_resource_file(self, resource_file):
blobs = self.list_container_contents(resource_file.source, container, storage_client)
return convert_blobs_to_resource_files(blobs, resource_file)
if resource_file.source.container_url:
# Input data storage in arbitrary container
uri = urlsplit(resource_file.source.container_url)
container = uri.pathname.split('/')[1]
blobs = self.list_container_contents(resource_file.source, container, storage_client)
return convert_blobs_to_resource_files(blobs, resource_file)
return resource_file.source.container_url
if resource_file.source.url:
# TODO: Input data from an arbitrary HTTP GET source
raise ValueError('Not implemented')
Expand Down
2 changes: 1 addition & 1 deletion azext/batch/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

VERSION = "7.0.0"
VERSION = "8.0.0"
5 changes: 5 additions & 0 deletions batch-cli-extensions/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

6.0.0 (2020-06-15)
------------------

* Update SDK dependency to get latest models and defaults

5.0.1 (2019-08-20)
------------------

Expand Down
3 changes: 3 additions & 0 deletions batch-cli-extensions/azext_batch/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def load_arguments(self, _):
c.argument('start_task_wait_for_success', arg_group='Pool: Start Task', action='store_true', help='Whether the Batch service should wait for the start task to complete successfully (that is, to exit with exit code 0) before scheduling any tasks on the compute node. If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is false. True if flag present.')
c.argument('os_family', arg_group="Pool: Cloud Service Configuration",
help='The Azure Guest OS family to be installed on the virtual machines in the pool. Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). Allowed values: 2, 3, 4, 5.')
c.extra('disk_encryption_targets',
arg_group="Pool: Virtual Machine Configuration",
help='A space seperated list of DiskEncryptionTargets. current possible values include OsDisk and TemporaryDisk.')
c.argument('node_agent_sku_id', arg_group="Pool: Virtual Machine Configuration", help='The SKU of the Batch node agent to be provisioned on compute nodes in the pool. The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the \'List supported node agent SKUs\' operation.')
c.argument('image', completer=load_supported_images, arg_group="Pool: Virtual Machine Configuration",
help="OS image reference. This can be either 'publisher:offer:sku[:version]' format, or a fully qualified ARM image id of the form '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}'. If 'publisher:offer:sku[:version]' format, version is optional and if omitted latest will be used. Valid values can be retrieved via 'az batch pool node-agent-skus list'. For example: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest'")
Expand Down
2 changes: 1 addition & 1 deletion batch-cli-extensions/azext_batch/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.minCliCoreVersion": "2.0.73",
"azext.minCliCoreVersion": "2.0.74",
"azext.maxCliCoreVersion": "3.0.0"
}
23 changes: 21 additions & 2 deletions batch-cli-extensions/azext_batch/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,29 @@
# pylint: disable=redefined-builtin


def disk_encryption_target_format(value):
"""Space seperated target disks to be encrypted. Values can either be OsDisk or TemporaryDisk"""
from azext.batch.models import DiskEncryptionTarget
if value == 'OsDisk':
return DiskEncryptionTarget.os_disk
if value == 'TemporaryDisk':
return DiskEncryptionTarget.temporary_disk
message = 'Argument {} is not a valid disk_encryption_target'
raise ValueError(message.format(value))


def create_pool(client, template=None, parameters=None, json_file=None, id=None, vm_size=None, # pylint:disable=too-many-arguments, too-many-locals
target_dedicated_nodes=None, target_low_priority_nodes=None, auto_scale_formula=None, # pylint: disable=redefined-builtin
enable_inter_node_communication=False, os_family=None, image=None,
enable_inter_node_communication=False, os_family=None, image=None, disk_encryption_targets=None,
node_agent_sku_id=None, resize_timeout=None, start_task_command_line=None,
start_task_resource_files=None, start_task_wait_for_success=False, application_licenses=None,
certificate_references=None, application_package_references=None, metadata=None):
# pylint: disable=too-many-branches, too-many-statements
from azext.batch.errors import MissingParameterValue
from azext.batch.models import (
PoolAddOptions, StartTask, ImageReference,
CloudServiceConfiguration, VirtualMachineConfiguration)
CloudServiceConfiguration, VirtualMachineConfiguration,
DiskEncryptionConfiguration)
if template or json_file:
if template:
json_obj = None
Expand Down Expand Up @@ -81,6 +93,13 @@ def create_pool(client, template=None, parameters=None, json_file=None, id=None,
pool.virtual_machine_configuration = VirtualMachineConfiguration(
image_reference=ImageReference(publisher=publisher, offer=offer, sku=sku, version=version),
node_agent_sku_id=node_agent_sku_id)
if disk_encryption_targets:
targets = disk_encryption_targets.split(' ')
parsed_targets = []
for target in targets:
parsed_targets.append(
disk_encryption_target_format(target))
pool.virtual_machine_configuration.disk_configuration = DiskEncryptionConfiguration(targets=parsed_targets)
except ValueError:
if '/' not in image:
message = ("Incorrect format for VM image. Should be in the format: \n"
Expand Down
2 changes: 1 addition & 1 deletion batch-cli-extensions/azext_batch/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

VERSION = "5.0.2"
VERSION = "6.0.0"
2 changes: 1 addition & 1 deletion batch-cli-extensions/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
]

DEPENDENCIES = [
'azure-batch-extensions>=7.0.0,<7.1',
'azure-batch-extensions>=8.0.0,<8.1',
'pycparser==2.18'
]

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

DEPENDENCIES = [
'msrestazure>=0.4.14,<1',
'azure-batch>=8.0,<9',
'azure-mgmt-batch>=7.0,<8',
'azure-batch>=9.0,<10',
'azure-mgmt-batch>=9.0,<10',
'azure-storage-blob>=1.1.0,<2',
'azure-mgmt-storage>=2.0,<3'
]
Expand Down
12,497 changes: 5,366 additions & 7,131 deletions tests/recordings/test_batch_extensions_live.yaml

Large diffs are not rendered by default.

Loading

0 comments on commit bce284a

Please sign in to comment.