Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 17 additions & 30 deletions azext/batch/_file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,36 +320,23 @@ def get_container_list(self, source):

def resolve_resource_file(self, resource_file):
"""Convert new resourceFile reference to server-supported reference"""
if resource_file.http_url:
# Support original resourceFile reference
if not resource_file.file_path:
raise ValueError('Malformed ResourceFile: \'httpUrl\' must '
'also have \'file_path\' attribute')
return [resource_file]

if resource_file.storage_container_url or resource_file.auto_storage_container_name:
return [resource_file]

if not hasattr(resource_file, 'source') or not resource_file.source:
raise ValueError('Malformed ResourceFile: Must have either '
' \'source\' or \'httpUrl\'')

storage_client = self.resolve_storage_account()
container = None
blobs = []

if resource_file.source.file_group:
# Input data stored in auto-storage
container = get_container_name(resource_file.source.file_group)
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)
if resource_file.source.url:
# TODO: Input data from an arbitrary HTTP GET source
raise ValueError('Not implemented')
raise ValueError('Malformed ResourceFile')
if hasattr(resource_file, 'source') and resource_file.source:
if resource_file.source.file_group:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For latest cli, can we just call native batch feature instead of client work?

# Input data stored in auto-storage
container = get_container_name(resource_file.source.file_group)
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)
if resource_file.source.url:
# TODO: Input data from an arbitrary HTTP GET source
raise ValueError('Not implemented')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change to "Not supported with source.url"?


return [resource_file]
4 changes: 2 additions & 2 deletions azext/batch/_template_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import copy
import itertools
import json
from logging import getLogger
import logging
import re
from msrest.serialization import Model
try:
Expand All @@ -21,7 +21,7 @@
from . import _pool_utils as pool_utils
from . import models

logger = getLogger(__name__)
logger = logging.getLogger(__name__)
try:
_UNICODE_TYPE = unicode
except NameError:
Expand Down
19 changes: 19 additions & 0 deletions azext/batch/_vendor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Batch CLI Vendoring

For each breaking change, to support back comparability we will need to vendor
our last SDK and SDK Extension. This allows us to serialize/deserialize to that
versions models as well as maintain any templating policies which were in place.

To vendor the previous SDK:
* pip download -r azure-batch-extensions==x.x.x
* Delete all dependencies/files other than:
* azext/batch/models
* azext/batch/init.py
* azext/batch/_file_utils.py
* azext/batch/_pool_utils.py
* azext/batch/_template_utils.py
* azext/batch/errors.py
* azure/batch/models
* azext/batch/init.py
* Update azext\batch\models\constants.py SupportedRestApi variables to include
details on API version
10 changes: 10 additions & 0 deletions azext/batch/_vendor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions azext/batch/_vendor/v4/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions azext/batch/_vendor/v4/azext/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions azext/batch/_vendor/v4/azext/batch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
Loading