Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Code dump for azure-ai-ml 0.1.0b6 #25496

Merged
merged 17 commits into from
Aug 9, 2022
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 22 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,28 @@
"Fdeployments",
"isfolder",
"mylist",
"unioned"
"unioned",
"adamw",
"yolov",
"xdist",
"adla",
"listxattr",
"copyxattr",
"curatedenv",
"cuda",
"mkdtemp",
"runit",
"delim",
"curr",
"vendored",
"wasb",
"cgitb",
"isclass",
"isfunction",
"errno",
"firstlineno",
"chdir",
"fset"
]
},
{
Expand Down
17 changes: 8 additions & 9 deletions sdk/ml/azure-ai-ml/azure/ai/ml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@

__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

from .entities._job.distribution import MpiDistribution, PyTorchDistribution, TensorFlowDistribution

from ._ml_client import MLClient
import logging
from ._utils.utils import initialize_logger_info
from azure.ai.ml.entities._inputs_outputs import Input, Output
from .entities._builders.command_func import command

# from .entities._builders.parallel_func import parallel
from azure.ai.ml._restclient.v2022_02_01_preview.models import ManagedIdentity, AmlToken, UserIdentity
from azure.ai.ml._restclient.v2022_02_01_preview.models import AmlToken, ManagedIdentity, UserIdentity
from azure.ai.ml.entities._inputs_outputs import Input, Output

from ._ml_client import MLClient
from ._utils.utils import initialize_logger_info
from .entities._builders.command_func import command
from .entities._job.distribution import MpiDistribution, PyTorchDistribution, TensorFlowDistribution
from .entities._load_functions import (
load_batch_deployment,
load_batch_endpoint,
load_component,
load_compute,
load_data,
load_datastore,
load_model,
load_environment,
load_job,
load_model,
load_online_deployment,
load_online_endpoint,
load_workspace,
Expand All @@ -37,7 +36,7 @@
__all__ = [
"MLClient",
"command",
# "parallel",
# "parallel",
"Input",
"Output",
"MpiDistribution",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@


from .arm_deployment_executor import ArmDeploymentExecutor
from .online_deployment_arm_generator import OnlineDeploymentArmGenerator


__all__ = ["ArmDeploymentExecutor", "OnlineDeploymentArmGenerator"]
__all__ = ["ArmDeploymentExecutor"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

from typing import Dict, Any, Optional
# pylint: disable=protected-access

import logging
import time
from typing import Any, Dict, Optional

from azure.ai.ml._arm_deployments.arm_helper import deployment_message_mapping
from azure.ai.ml._azure_environments import (
_get_cloud_details,
_get_azure_portal_id_from_metadata,
_get_base_url_from_metadata,
_get_cloud_details,
_resource_to_scopes,
_get_azure_portal_id_from_metadata,
)
from azure.core.polling import LROPoller
from azure.ai.ml._arm_deployments.arm_helper import deployment_message_mapping
from azure.ai.ml._ml_exceptions import ErrorCategory, ErrorTarget, ValidationException
from azure.ai.ml._utils._arm_id_utils import get_arm_id_object_from_id
from azure.ai.ml._utils.utils import from_iso_duration_format_min_sec, initialize_logger_info
from azure.ai.ml._vendor.azure_resources._resource_management_client import ResourceManagementClient
from azure.ai.ml._vendor.azure_resources.models import Deployment, DeploymentProperties
from azure.ai.ml.constants import ENDPOINT_DEPLOYMENT_START_MSG, ArmConstants, LROConfigurations, OperationStatus
from azure.core.polling import LROPoller
from azure.identity import ChainedTokenCredential
import logging
from azure.ai.ml._vendor.azure_resources.models import DeploymentProperties, Deployment
import time
from azure.ai.ml._utils.utils import from_iso_duration_format_min_sec, initialize_logger_info
from azure.ai.ml.constants import (
ArmConstants,
ENDPOINT_DEPLOYMENT_START_MSG,
OperationStatus,
LROConfigurations,
)
from azure.ai.ml._ml_exceptions import ErrorTarget, ErrorCategory, ValidationException

module_logger = logging.getLogger(__name__)
initialize_logger_info(module_logger, terminator="")
Expand Down Expand Up @@ -140,7 +138,8 @@ def _get_poller(self, template: str, parameters: Dict = None, wait: bool = True)

def _check_deployment_status(self, resources_deployed: Dict[str, Any]) -> None:
deployment_operations = self._deployment_operations_client.list(
resource_group_name=self._resource_group_name, deployment_name=self._deployment_name
resource_group_name=self._resource_group_name,
deployment_name=self._deployment_name,
)

for deployment_operation in deployment_operations:
Expand All @@ -162,7 +161,10 @@ def _check_deployment_status(self, resources_deployed: Dict[str, Any]) -> None:
)
deployment_message = deployment_message_mapping[arm_id_obj.asset_type].format(f"{resource_name} ")
if target_resource.resource_name not in self._resources_being_deployed.keys():
self._resources_being_deployed[target_resource.resource_name] = (deployment_message, None)
self._resources_being_deployed[target_resource.resource_name] = (
deployment_message,
None,
)

if (
properties.provisioning_state
Expand Down Expand Up @@ -193,7 +195,10 @@ def _check_deployment_status(self, resources_deployed: Dict[str, Any]) -> None:
except Exception:
duration_in_min_sec = ""

self._resources_being_deployed[resource_name] = (resource_type, provisioning_state)
self._resources_being_deployed[resource_name] = (
resource_type,
provisioning_state,
)

if provisioning_state == OperationStatus.FAILED and previous_state != OperationStatus.FAILED:
status_code = properties.status_code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# ---------------------------------------------------------

from os import path
from typing import Dict, Any
from typing import Any, Dict

from azure.ai.ml._ml_exceptions import ErrorTarget, ValidationException
from azure.ai.ml._utils.utils import load_json
from azure.ai.ml.constants import ArmConstants, AzureMLResourceType
from azure.ai.ml._ml_exceptions import ErrorTarget, ValidationException

template_mapping = {
ArmConstants.BASE_TYPE: "base_template.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@
"tags": "[parameters('tagValues')]",
"apiVersion": "2018-05-01-preview",
"name": "[parameters('applicationInsightsName')]",
"location": "[if(or(equals(toLower(parameters('applicationInsightsLocation')),'westcentralus'), equals(toLower(parameters('applicationInsightsLocation')),'centralus'), equals(toLower(parameters('applicationInsightsLocation')),'eastus2euap'), equals(toLower(parameters('applicationInsightsLocation')),'centraluseuap')),'southcentralus',parameters('applicationInsightsLocation'))]",
"location": "[if(or(equals(toLower(parameters('applicationInsightsLocation')),'westcentralus'), equals(toLower(parameters('applicationInsightsLocation')),'centralus'), equals(toLower(parameters('applicationInsightsLocation')),'westus3'), equals(toLower(parameters('applicationInsightsLocation')),'eastus2euap'), equals(toLower(parameters('applicationInsightsLocation')),'centraluseuap')),'southcentralus',parameters('applicationInsightsLocation'))]",
"kind": "web",
"properties": {
"Application_Type": "web"
Expand Down
Loading