Skip to content

Commit b8bada6

Browse files
Feature set back fill response and notification type fixes (Azure#29391)
* Updating feature set and feature store entity operations to use get_entity * Remove archive and restore for feature set and feature store entity * fix lint * Remove tests * Adding archive and restore for version * Adding line * Scheme update for feature set spec * Remove unused imports * remove not used properties * revert * Fix relative path issue for FeaturesetSpec yaml * Fix notification email on values * Update notification email on * Fix back fill response
1 parent e23d9a6 commit b8bada6

File tree

6 files changed

+44
-9
lines changed

6 files changed

+44
-9
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_notification/notification_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class NotificationSchema(metaclass=PatchedSchemaMeta):
1313
email_on = fields.List(
14-
fields.Str(validate=validate.OneOf(["jobcompleted", "jobfailed", "jobcanceled"])),
14+
fields.Str(validate=validate.OneOf(["JobCompleted", "JobFailed", "JobCancelled"])),
1515
required=True,
1616
allow_none=False,
1717
)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@
150150
from ._feature_set.materialization_compute_resource import _MaterializationComputeResource
151151
from ._feature_set.materialization_settings import _MaterializationSettings
152152
from ._feature_set.materialization_type import _MaterializationType
153+
from ._feature_set.feature_set_backfill_response import _FeatureSetBackfillResponse
154+
from ._feature_set.feature_set_materialization_response import _FeatureSetMaterializationResponse
153155
from ._feature_store.feature_store import _FeatureStore
154156
from ._feature_store.materialization_store import _MaterializationStore
155157
from ._notification.notification import _Notification
@@ -304,6 +306,8 @@
304306
"_FeatureStore",
305307
"_MaterializationStore",
306308
"_Notification",
309+
"_FeatureSetBackfillResponse",
310+
"_FeatureSetMaterializationResponse",
307311
# builders
308312
"Command",
309313
"Parallel",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ---------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# ---------------------------------------------------------
4+
5+
from typing import Optional
6+
7+
from azure.ai.ml._restclient.v2023_02_01_preview.models import (
8+
FeaturesetVersionBackfillResponse as RestFeaturesetVersionBackfillResponse,
9+
)
10+
from azure.ai.ml.entities._mixins import RestTranslatableMixin
11+
from azure.ai.ml._utils._experimental import experimental
12+
13+
14+
@experimental
15+
class _FeatureSetBackfillResponse(RestTranslatableMixin):
16+
def __init__(
17+
self,
18+
*,
19+
job_id: Optional[str] = None,
20+
type: Optional[str] = None, # pylint: disable=redefined-builtin
21+
**kwargs # pylint: disable=unused-argument
22+
):
23+
self.type = type if type else "BackfillMaterialization"
24+
self.job_id = job_id
25+
26+
@classmethod
27+
def _from_rest_object(cls, obj: RestFeaturesetVersionBackfillResponse) -> "_FeatureSetBackfillResponse":
28+
if not obj:
29+
return None
30+
return _FeatureSetBackfillResponse(job_id=obj.job_id)

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_notification/notification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class _Notification(RestTranslatableMixin):
1717
def __init__(self, *, email_on: Optional[List[str]] = None, emails: Optional[List[str]] = None):
1818
"""
1919
:keyword email_on: Send email notification to user on specified notification type.
20-
:paramtype email_on: list[Literal]. Values can be [jobcompleted, jobfailed, jobcanceled]
20+
:paramtype email_on: list[Literal]. Values can be [JobCompleted, JobFailed, JobCancelled]
2121
:keyword emails: This is the email recipient list which has a limitation of 499 characters in
2222
total concat with comma seperator.
2323
:paramtype emails: list[str]

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_set_operations.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from azure.ai.ml.entities._feature_set.featureset_spec_metadata import FeaturesetSpecMetadata
3939
from azure.ai.ml.entities._feature_set.materialization_compute_resource import _MaterializationComputeResource
4040
from azure.ai.ml.entities._feature_set.feature_set_materialization_response import _FeatureSetMaterializationResponse
41+
from azure.ai.ml.entities._feature_set.feature_set_backfill_response import _FeatureSetBackfillResponse
4142
from azure.ai.ml.entities._feature_set.feature import _Feature
4243
from azure.core.polling import LROPoller
4344
from azure.core.paging import ItemPaged
@@ -221,10 +222,10 @@ def begin_backfill(
221222
:param tags: A set of tags. Specifies the tags.
222223
:type tags: dict[str, str]
223224
:param compute_resource: Specifies the compute resource settings.
224-
:type compute_resource: ~azure.ai.ml.entities.MaterializationComputeResource
225+
:type compute_resource: ~azure.ai.ml.entities._MaterializationComputeResource
225226
:param spark_configuration: Specifies the spark compute settings.
226227
:type spark_configuration: dict[str, str]
227-
:return: An instance of LROPoller that returns _FeatureSetMaterializationResponse
228+
:return: An instance of LROPoller that returns ~azure.ai.ml.entities._FeatureSetBackfillResponse
228229
"""
229230

230231
request_body: FeaturesetVersionBackfillRequest = FeaturesetVersionBackfillRequest(
@@ -243,9 +244,7 @@ def begin_backfill(
243244
name=name,
244245
version=version,
245246
body=request_body,
246-
cls=lambda response, deserialized, headers: _FeatureSetMaterializationResponse._from_rest_object(
247-
deserialized
248-
),
247+
cls=lambda response, deserialized, headers: _FeatureSetBackfillResponse._from_rest_object(deserialized),
249248
)
250249

251250
# @monitor_with_activity(logger, "FeatureSet.ListMaterializationOperation", ActivityType.PUBLICAPI)
@@ -271,7 +270,7 @@ def list_materialization_operation(
271270
:type feature_window_end_time: datetime
272271
:param filters: Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2.
273272
:type filters: str
274-
:return: An iterator like instance of _FeatureSetMaterializationResponse objects
273+
:return: An iterator like instance of ~azure.ai.ml.entities._FeatureSetMaterializationResponse objects
275274
:rtype: ~azure.core.paging.ItemPaged[_FeatureSetMaterializationResponse]
276275
"""
277276

@@ -425,6 +424,8 @@ def validate_and_get_feature_set_spec(featureset: _FeatureSet) -> FeaturesetSpec
425424
)
426425

427426
featureset_spec_path = str(featureset.specification.path)
427+
if not os.path.isabs(featureset_spec_path):
428+
featureset_spec_path = Path(featureset.base_path, featureset_spec_path).resolve()
428429

429430
if not os.path.isdir(featureset_spec_path):
430431
raise ValidationException(

sdk/ml/azure-ai-ml/tests/test_configs/feature_set/feature_set_full.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ materialization_settings:
1515
hours: [12]
1616
minutes: [5]
1717
notification:
18-
email_on: [jobcompleted, jobfailed]
18+
email_on: [JobCompleted, JobFailed]
1919
emails: [fake@email.com, test@email.com]
2020
resource:
2121
instance_type: standard_e8s_v3

0 commit comments

Comments
 (0)