Skip to content

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

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

Merged
merged 5 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
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