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

Re-arrange imports and experimental tags to prevent warnings on unrelated operations #26892

Merged
merged 5 commits into from
Oct 20, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/ml/azure-ai-ml/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

### Bugs Fixed
- MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.
- Adjust registry experimental tags and imports to avoid warning printouts for unrelated operations.

### Other Changes

Expand Down
2 changes: 2 additions & 0 deletions sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from azure.ai.ml._restclient.v2022_10_01 import AzureMachineLearningWorkspaces as ServiceClient102022
from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationsContainer, OperationScope
from azure.ai.ml._user_agent import USER_AGENT
from azure.ai.ml._utils._experimental import experimental
from azure.ai.ml._utils._http_utils import HttpPipeline
from azure.ai.ml._utils._registry_utils import RegistryDiscovery
from azure.ai.ml._utils.utils import _is_https_url, _validate_missing_sub_or_rg_and_raise
Expand Down Expand Up @@ -562,6 +563,7 @@ def workspaces(self) -> WorkspaceOperations:
return self._workspaces

@property
@experimental
def registries(self) -> RegistryOperations:
"""A collection of registry-related operations.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
)
from azure.ai.ml._restclient.v2022_10_01_preview.models import Registry as RestRegistry
from azure.ai.ml._restclient.v2022_10_01_preview.models import RegistryProperties
from azure.ai.ml._schema.registry.registry import RegistrySchema
from azure.ai.ml._utils.utils import dump_yaml_to_file
from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY, PARAMS_OVERRIDE_KEY
from azure.ai.ml.entities._credentials import IdentityConfiguration
Expand Down Expand Up @@ -103,6 +102,8 @@ def dump(
# represented by the registry API, which differs from how registries
# are represented in YAML. This function converts those differences.
def _to_dict(self) -> Dict:
# JIT import to avoid experimental warnings on unrelated calls
from azure.ai.ml._schema.registry.registry import RegistrySchema
# pylint: disable=no-member
schema = RegistrySchema(context={BASE_PATH_CONTEXT_KEY: "./"})

Expand Down Expand Up @@ -142,6 +143,8 @@ def _load(
BASE_PATH_CONTEXT_KEY: Path(yaml_path).parent if yaml_path else Path("./"),
PARAMS_OVERRIDE_KEY: params_override,
}
# JIT import to avoid experimental warnings on unrelated calls
from azure.ai.ml._schema.registry.registry import RegistrySchema
loaded_schema = load_from_dict(RegistrySchema, data, context, **kwargs)
cls._convert_yaml_dict_to_entity_input(loaded_schema)
return Registry(**loaded_schema)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
ops_logger = OpsLogger(__name__)
module_logger = ops_logger.module_logger

@experimental
class RegistryOperations:
"""RegistryOperations.

Expand All @@ -51,6 +50,7 @@ def __init__(
self.containerRegistry = "none"
self._init_kwargs = kwargs

@experimental
#@ monitor_with_activity(logger, "Registry.List", ActivityType.PUBLICAPI)
def list(self, *, scope: str = Scope.RESOURCE_GROUP) -> Iterable[Registry]:
"""List all registries that the user has access to in the current
Expand All @@ -68,6 +68,7 @@ def list(self, *, scope: str = Scope.RESOURCE_GROUP) -> Iterable[Registry]:
return self._operation.list(cls=lambda objs: [Registry._from_rest_object(obj) for obj in objs], \
resource_group_name=self._resource_group_name)

@experimental
# @monitor_with_activity(logger, "Registry.Get", ActivityType.PUBLICAPI)
def get(self, name: str = None) -> Registry:
"""Get a registry by name.
Expand Down Expand Up @@ -108,6 +109,7 @@ def _get_polling(self, name):
path_format_arguments=path_format_arguments,
)

@experimental
# @monitor_with_activity(logger, "Registry.BeginCreate", ActivityType.PUBLICAPI)
def begin_create(
self,
Expand Down Expand Up @@ -136,6 +138,7 @@ def begin_create(
return poller


@experimental
# @monitor_with_activity(logger, "Registry.Delete", ActivityType.PUBLICAPI)
def delete(self, *, name: str, **kwargs: Dict) -> None:
"""Delete a registry. Returns nothing on a successful operation.
Expand Down