Skip to content

Commit bc135cb

Browse files
Add projects and hubs to AML SDK. (#35142)
* initial dump * run black * black, mypy, lint * test corrections 1 * rerun black * remove outdated test * refactor polymorphism to not need more load functions * syntax checks * refactor constant to not be enum to avoid type problems * update assets * more test corrections * more test corrections, feature store kind refactor * rename type to kind * show associated workspaces in yaml view * assign project values from hub during creation * formatting * record pna in projects * rename remove project from default_project_resource_group * Update sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py Co-authored-by: kdestin <[email protected]> * Update sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py Co-authored-by: kdestin <[email protected]> * Update sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py Co-authored-by: kdestin <[email protected]> * Update sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py Co-authored-by: kdestin <[email protected]> * name consistency * undo enumification of workspace kind --------- Co-authored-by: kdestin <[email protected]>
1 parent 06ccc73 commit bc135cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+907
-901
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@
44

55
### Features Added
66

7+
- Renamed WorkspaceHub class as Hub.
8+
- Added Project entity class and YAML support.
9+
- Project and Hub operations supported by workspace operations.
10+
- workspace list operation supports type filtering.
11+
712
### Bugs Fixed
813

914
### Breaking Changes
1015

16+
- Removed WorkspaceHubConfig entity, and renamed WorkspaceHub to Hub.
17+
- workspace_hub input of Workspace class hidden, renamed to hub_id, and re-surfaced in child class Project.
18+
- Removed Workspace Hub Operations from ML Client.
19+
1120
### Other Changes
1221

1322
## 1.15.0 (2024-03-26)

sdk/ml/azure-ai-ml/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/ml/azure-ai-ml",
5-
"Tag": "python/ml/azure-ai-ml_baea630318"
5+
"Tag": "python/ml/azure-ai-ml_cfba1d7771"
66
}

sdk/ml/azure-ai-ml/azure/ai/ml/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
load_registry,
3636
load_workspace,
3737
load_workspace_connection,
38-
load_workspace_hub,
3938
)
4039

4140
module_logger = logging.getLogger(__name__)
@@ -69,7 +68,6 @@
6968
"load_workspace",
7069
"load_registry",
7170
"load_workspace_connection",
72-
"load_workspace_hub",
7371
"load_model_package",
7472
]
7573

sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationsContainer, OperationScope
4444
from azure.ai.ml._telemetry.logging_handler import get_appinsights_log_handler
4545
from azure.ai.ml._user_agent import USER_AGENT
46-
from azure.ai.ml._utils._experimental import experimental
4746
from azure.ai.ml._utils._http_utils import HttpPipeline
4847
from azure.ai.ml._utils._preflight_utils import get_deployments_operation
4948
from azure.ai.ml._utils._registry_utils import get_registry_client
@@ -82,7 +81,6 @@
8281
OnlineEndpointOperations,
8382
RegistryOperations,
8483
WorkspaceConnectionsOperations,
85-
WorkspaceHubOperations,
8684
WorkspaceOperations,
8785
)
8886
from azure.ai.ml.operations._code_operations import CodeOperations
@@ -658,15 +656,6 @@ def __init__(
658656
**ops_kwargs, # type: ignore[arg-type]
659657
)
660658

661-
self._workspace_hubs = WorkspaceHubOperations(
662-
self._operation_scope,
663-
self._service_client_08_2023_preview,
664-
self._operation_container,
665-
self._credential,
666-
**app_insights_handler_kwargs, # type: ignore[arg-type]
667-
)
668-
self._operation_container.add(AzureMLResourceType.WORKSPACE_HUB, self._workspace_hubs) # type: ignore[arg-type]
669-
670659
self._operation_container.add(AzureMLResourceType.FEATURE_STORE, self._featurestores) # type: ignore[arg-type]
671660
self._operation_container.add(AzureMLResourceType.FEATURE_SET, self._featuresets)
672661
self._operation_container.add(AzureMLResourceType.FEATURE_STORE_ENTITY, self._featurestoreentities)
@@ -811,7 +800,8 @@ def _ml_client_cli(cls, credentials: TokenCredential, subscription_id: Optional[
811800

812801
@property
813802
def workspaces(self) -> WorkspaceOperations:
814-
"""A collection of workspace-related operations.
803+
"""A collection of workspace-related operations. Also manages workspace
804+
sub-classes like projects and hubs.
815805
816806
:return: Workspace operations
817807
:rtype: ~azure.ai.ml.operations.WorkspaceOperations
@@ -854,16 +844,6 @@ def feature_sets(self) -> FeatureSetOperations:
854844
"""
855845
return self._featuresets
856846

857-
@property
858-
@experimental
859-
def workspace_hubs(self) -> WorkspaceHubOperations:
860-
"""A collection of workspace hub-related operations.
861-
862-
:return: Hub Operations
863-
:rtype: HubOperations
864-
"""
865-
return self._workspace_hubs
866-
867847
@property
868848
def feature_store_entities(self) -> FeatureStoreEntityOperations:
869849
"""A collection of feature store entity related operations.

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_workspace_hub/workspace_hub.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_workspace_hub/workspace_hub_config.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
66

77
from .workspace import WorkspaceSchema
8+
from .ai_workspaces.project import ProjectSchema
9+
from .ai_workspaces.hub import HubSchema
810

9-
__all__ = ["WorkspaceSchema"]
11+
__all__ = ["WorkspaceSchema", "ProjectSchema", "HubSchema"]

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_workspace_hub/__init__.py renamed to sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/ai_workspaces/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
# ---------------------------------------------------------
44

55
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
6-
7-
from .workspace_hub import WorkspaceHubSchema
8-
9-
__all__ = ["WorkspaceHubSchema"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ---------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# ---------------------------------------------------------
4+
5+
from marshmallow import fields
6+
7+
from azure.ai.ml._schema import StringTransformedEnum
8+
from azure.ai.ml._schema.workspace import WorkspaceSchema
9+
from azure.ai.ml._utils._experimental import experimental
10+
from azure.ai.ml.constants import WorkspaceKind
11+
12+
13+
@experimental
14+
class HubSchema(WorkspaceSchema):
15+
# additional_workspace_storage_accounts This field exists in the API, but is unused, and thus not surfaced yet.
16+
kind = StringTransformedEnum(required=True, allowed_values=WorkspaceKind.HUB)
17+
default_resource_group = fields.Str(required=False)
18+
associated_workspaces = fields.List(fields.Str(), required=False, dump_only=True)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# ---------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# ---------------------------------------------------------
4+
5+
from marshmallow import fields
6+
7+
from azure.ai.ml._schema import StringTransformedEnum
8+
from azure.ai.ml._utils._experimental import experimental
9+
from azure.ai.ml._schema.workspace import WorkspaceSchema
10+
from azure.ai.ml.constants import WorkspaceKind
11+
12+
13+
@experimental
14+
class ProjectSchema(WorkspaceSchema):
15+
kind = StringTransformedEnum(required=True, allowed_values=WorkspaceKind.PROJECT)
16+
hub_id = fields.Str(required=True)

0 commit comments

Comments
 (0)