Skip to content

Commit 0bf8db1

Browse files
authored
fix: add _source in rest object of internal component (Azure#28523)
1 parent 1dc56cb commit 0bf8db1

File tree

43 files changed

+4184
-6358
lines changed

Some content is hidden

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

43 files changed

+4184
-6358
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_internal/entities/component.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def _from_rest_object_to_init_params(cls, obj: ComponentVersionData) -> Dict:
191191

192192
def _to_rest_object(self) -> ComponentVersionData:
193193
component = convert_ordered_dict_to_dict(self._to_dict())
194+
component["_source"] = self._source
194195

195196
properties = ComponentVersionDetails(
196197
component_spec=component,

sdk/ml/azure-ai-ml/tests/internal/e2etests/test_component.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def test_component_load(
9999
json.dump(loaded_dict, f, indent=2)
100100
with open(json_path, "r") as f:
101101
expected_dict = json.load(f)
102+
expected_dict["_source"] = "REMOTE.WORKSPACE.COMPONENT"
102103

103104
# TODO: check if loaded environment is expected to be an ordered dict
104105
assert pydash.omit(loaded_dict, *omit_fields) == pydash.omit(expected_dict, *omit_fields)

sdk/ml/azure-ai-ml/tests/internal/unittests/test_component.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def test_load_from_registered_internal_command_component_rest_obj(self):
8181
"tags": {"category": "Component Tutorial", "contact": "amldesigner@microsoft.com"},
8282
"type": "CommandComponent",
8383
"$schema": "https://componentsdk.azureedge.net/jsonschema/CommandComponent.json",
84+
"_source": "CLASS",
8485
"version": "0.0.1",
8586
"display_name": "0.0.1",
8687
"is_deterministic": True,
@@ -139,6 +140,7 @@ def test_load_from_registered_internal_scope_component_rest_obj(self):
139140
"tags": {"org": "bing", "project": "relevance"},
140141
"type": "ScopeComponent",
141142
"$schema": "https://componentsdk.azureedge.net/jsonschema/CommandComponent.json",
143+
"_source": "CLASS",
142144
"version": "85b54741.0bf9.4734.a5bb.0e469c7bf792",
143145
"display_name": "Convert Text to StructureStream",
144146
"is_deterministic": True,
@@ -218,8 +220,11 @@ def test_component_serialization(self, yaml_path):
218220
expected_dict["code"] = parse_local_path(expected_dict["code"], entity.base_path)
219221

220222
assert entity._to_dict() == expected_dict
223+
224+
expected_rest_object = copy.deepcopy(expected_dict)
225+
expected_rest_object["_source"] = "YAML.COMPONENT"
221226
rest_obj = entity._to_rest_object()
222-
assert rest_obj.properties.component_spec == expected_dict
227+
assert rest_obj.properties.component_spec == expected_rest_object
223228

224229
# inherit input type map from Component._from_rest_object
225230
for input_port in expected_dict.get("inputs", {}).values():

sdk/ml/azure-ai-ml/tests/recordings/internal/e2etests/test_component.pyTestComponenttest_component_code_hash.json

Lines changed: 98 additions & 96 deletions
Large diffs are not rendered by default.

sdk/ml/azure-ai-ml/tests/recordings/internal/e2etests/test_component.pyTestComponenttest_component_create[tests/test_configs/internal/ae365exepool-component/component_spec.yaml].json

Lines changed: 61 additions & 60 deletions
Large diffs are not rendered by default.

sdk/ml/azure-ai-ml/tests/recordings/internal/e2etests/test_component.pyTestComponenttest_component_create[tests/test_configs/internal/batch_inference/batch_score.yaml].json

Lines changed: 61 additions & 60 deletions
Large diffs are not rendered by default.

sdk/ml/azure-ai-ml/tests/recordings/internal/e2etests/test_component.pyTestComponenttest_component_create[tests/test_configs/internal/command-component-ls/ls_command_component.yaml].json

Lines changed: 60 additions & 59 deletions
Large diffs are not rendered by default.

sdk/ml/azure-ai-ml/tests/recordings/internal/e2etests/test_component.pyTestComponenttest_component_create[tests/test_configs/internal/data-transfer-component/component_spec.yaml].json

Lines changed: 60 additions & 59 deletions
Large diffs are not rendered by default.

sdk/ml/azure-ai-ml/tests/recordings/internal/e2etests/test_component.pyTestComponenttest_component_create[tests/test_configs/internal/distribution-component/component_spec.yaml].json

Lines changed: 60 additions & 59 deletions
Large diffs are not rendered by default.

sdk/ml/azure-ai-ml/tests/recordings/internal/e2etests/test_component.pyTestComponenttest_component_create[tests/test_configs/internal/hdi-component/component_spec.yaml].json

Lines changed: 60 additions & 59 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)