Skip to content

Commit afe3141

Browse files
anyalee0221anya-li
andauthored
Not support source_delay and source_process_code for derived featureset (#35250)
* Not support source_delay and source_precess_code for derived featureset * update unit test * update unit test * update msg format * update format --------- Co-authored-by: Anya Li <[email protected]>
1 parent 4f9fecc commit afe3141

File tree

4 files changed

+66
-2
lines changed

4 files changed

+66
-2
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_feature_set/source_metadata.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ def __init__(
4747
target=ErrorTarget.FEATURE_SET,
4848
error_category=ErrorCategory.USER_ERROR,
4949
)
50-
if timestamp_column:
51-
msg = f"Cannot provide timestamp_column for {type} feature source."
50+
if timestamp_column or source_delay or source_process_code:
51+
msg = f"Cannot provide timestamp_column/source_delay/source_process_code for {type} feature source."
5252
raise ValidationException(
5353
message=msg,
5454
no_personal_data_message=msg,
5555
error_type=ValidationErrorType.INVALID_VALUE,
5656
target=ErrorTarget.FEATURE_SET,
5757
error_category=ErrorCategory.USER_ERROR,
5858
)
59+
5960
if not (path and not dict and not source_process_code):
6061
msg = f"Cannot provide source_process_code or kwargs for {type} feature source."
6162
raise ValidationException(

sdk/ml/azure-ai-ml/tests/feature_set/unittests/test_feature_set_spec_schema.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,15 @@ def test_feature_set_spec_load_failure(self) -> None:
9191
featureset_spec_yaml_path = Path(spec_path, "FeatureSetSpec.yaml")
9292
with pytest.raises(ValidationException):
9393
FeaturesetSpecMetadata._load(featureset_spec_contents, featureset_spec_yaml_path)
94+
95+
spec_path = "./tests/test_configs/feature_set/invalid_spec8"
96+
featureset_spec_contents = read_feature_set_metadata(path=spec_path)
97+
featureset_spec_yaml_path = Path(spec_path, "FeatureSetSpec.yaml")
98+
with pytest.raises(ValidationException):
99+
FeaturesetSpecMetadata._load(featureset_spec_contents, featureset_spec_yaml_path)
100+
101+
spec_path = "./tests/test_configs/feature_set/invalid_spec9"
102+
featureset_spec_contents = read_feature_set_metadata(path=spec_path)
103+
featureset_spec_yaml_path = Path(spec_path, "FeatureSetSpec.yaml")
104+
with pytest.raises(ValidationException):
105+
FeaturesetSpecMetadata._load(featureset_spec_contents, featureset_spec_yaml_path)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# source_delay is not supported for featureset feature source
2+
source:
3+
type: featureset
4+
path: azureml://subscriptions/my_sub/resourcegroups/my_rg/workspaces/my_fs/feturesets/source_feature_set_name/versions/version1
5+
source_delay:
6+
days: 2
7+
hours: 0
8+
minutes: 0
9+
feature_transformation_code:
10+
path: ./code
11+
transformer_class: driver_hourly_transform.DriverHourlyTransformer
12+
features:
13+
- name: conv_rate
14+
type: double
15+
- name: acc_rate
16+
type: double
17+
- name: avg_daily_trips
18+
type: double
19+
source_lookback:
20+
days: 30
21+
hours: 0
22+
minutes: 0
23+
temporal_join_lookback:
24+
days: 2
25+
hours: 0
26+
minutes: 0
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# source_process_code is not supported for featureset feature source
2+
source:
3+
type: featureset
4+
path: azureml://subscriptions/my_sub/resourcegroups/my_rg/workspaces/my_fs/feturesets/source_feature_set_name/versions/version1
5+
source_process_code:
6+
path: ./source_process_code
7+
process_class: source_process.MyDataSourceLoader
8+
feature_transformation_code:
9+
path: ./code
10+
transformer_class: driver_hourly_transform.DriverHourlyTransformer
11+
features:
12+
- name: conv_rate
13+
type: double
14+
- name: acc_rate
15+
type: double
16+
- name: avg_daily_trips
17+
type: double
18+
source_lookback:
19+
days: 30
20+
hours: 0
21+
minutes: 0
22+
temporal_join_lookback:
23+
days: 2
24+
hours: 0
25+
minutes: 0

0 commit comments

Comments
 (0)