Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit e0ec8ca

Browse files
[InternalComponent] Add is_link_mode to internal component output (Azure#27717)
* fix link mode * fix link mode * test: add test for internal output attrs * refactor: make environment_variables a property Co-authored-by: Xingzhi Zhang <zhangxingzhi@microsoft.com>
1 parent d5a08a5 commit e0ec8ca

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ def _from_base(cls, _input: Union[Input, Dict]) -> Optional["InternalInput"]:
106106

107107

108108
class InternalOutput(Output):
109-
def __init__(self, *, datastore_mode=None, **kwargs):
109+
def __init__(self, *, datastore_mode=None, is_link_mode=None, **kwargs):
110110
self.datastore_mode = datastore_mode
111+
self.is_link_mode = is_link_mode
111112
super().__init__(**kwargs)
112113

113114
@classmethod

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, **kwargs):
3030
self._resources = kwargs.pop("resources", JobResourceConfiguration())
3131
self._compute = kwargs.pop("compute", None)
3232
self._environment = kwargs.pop("environment", None)
33-
self.environment_variables = kwargs.pop("environment_variables", None)
33+
self._environment_variables = kwargs.pop("environment_variables", None)
3434
self._limits = kwargs.pop("limits", CommandJobLimits())
3535
self._init = False
3636

@@ -54,6 +54,16 @@ def environment(self, value: str):
5454
"""Set the environment definition for the command."""
5555
self._environment = value
5656

57+
@property
58+
def environment_variables(self) -> Dict[str, str]:
59+
"""Get the environment variables for the command."""
60+
return self._environment_variables
61+
62+
@environment_variables.setter
63+
def environment_variables(self, value: Dict[str, str]):
64+
"""Set the environment variables for the command."""
65+
self._environment_variables = value
66+
5767
@property
5868
def limits(self) -> CommandJobLimits:
5969
return self._limits

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,18 @@ def test_component_input_with_attrs(self) -> None:
581581
# yes will be converted to true in YAML 1.2, users may use "yes" as a workaround
582582
"param_string_with_yes_value": {"default": "True", "type": "string"},
583583
"param_string_with_quote_yes_value": {"default": "yes", "type": "string"},
584+
},
585+
"outputs": {
586+
'output_data_path': {
587+
'datastore_mode': 'mount',
588+
'description': 'Path to the data',
589+
'is_link_mode': True,
590+
'type': 'path'
591+
}
584592
}
585593
}
586594
assert component._to_rest_object().properties.component_spec["inputs"] == expected_inputs["inputs"]
595+
assert component._to_rest_object().properties.component_spec["outputs"] == expected_inputs["outputs"]
587596
assert component._validate().passed is True, repr(component._validate())
588597

589598
regenerated_component = Component._from_rest_object(component._to_rest_object())

sdk/ml/azure-ai-ml/tests/test_configs/internal/component_with_input_outputs/component_spec_with_attrs.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ inputs:
4646
type: Enum
4747
enum: [minimal, reuse, expiry, policies]
4848

49+
outputs:
50+
output_data_path:
51+
type: path
52+
description: Path to the data
53+
is_link_mode: True
54+
datastore_mode: mount
55+
4956
environment: azureml:AzureEnv:1
5057

5158
scope:

0 commit comments

Comments
 (0)