Skip to content

Commit 78c330c

Browse files
lllilithyangchenyangliao
andauthored
Support download output of pipeline containing settings attribute (Azure#28962)
* add name and version for output * add asset_name, asset_version, merge 2022-12-01 pr * resolve comments * add test and modify related codes * refine code * fix failed test * fix comments * fix condition._port_name * fix test and some comments * revert the modification of compute * fix comments * fix pylint error, add tests for CommandJob, Spark, Parallel, Sweep * delete one test, will add in another pr * modify error message * fix settings, add ut * run black * add info in changelog --------- Co-authored-by: chenyangliao <[email protected]>
1 parent b91ece9 commit 78c330c

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features Added
66
- Added support for `tags` on Compute Resources.
77
- Added support for promoting data asset from a workspace to a registry
8+
- Added support for registering named asset from job output by specifying named and version settings.
89

910
### Bugs Fixed
1011

sdk/ml/azure-ai-ml/azure/ai/ml/entities/_builders/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def settings(self) -> PipelineJobSettings:
9797

9898
@settings.setter
9999
def settings(self, value):
100-
if value is not None and not isinstance(value, PipelineJobSettings):
100+
if value and not isinstance(value, PipelineJobSettings):
101101
raise TypeError("settings must be PipelineJobSettings or dict but got {}".format(type(value)))
102102
self._settings = value
103103

sdk/ml/azure-ai-ml/tests/job_common/unittests/test_job_operations.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,32 @@ def test_get(self, mock_method, mock_job_operation: JobOperations) -> None:
147147
mock_job_operation.get("randon_name")
148148
mock_job_operation._operation_2022_12_preview.get.assert_called_once()
149149

150+
@patch.object(JobOperations, "_get_job")
151+
def test_get_job(self, mock_method, mock_job_operation: JobOperations) -> None:
152+
from azure.ai.ml import Input, dsl, load_component
153+
154+
component = load_component(source="./tests/test_configs/components/helloworld_component.yml")
155+
component_input = Input(type="uri_file", path="https://dprepdata.blob.core.windows.net/demo/Titanic.csv")
156+
157+
@dsl.pipeline()
158+
def sub_pipeline():
159+
node = component(component_in_path=component_input)
160+
161+
@dsl.pipeline()
162+
def register_both_output():
163+
sub_node = sub_pipeline()
164+
165+
pipeline = register_both_output()
166+
pipeline.settings.default_compute = "cpu-cluster"
167+
pipeline.jobs["sub_node"]._component = "fake_component"
168+
169+
# add settings for subgraph node to simulate the result of getting pipeline that submitted with previous sdk
170+
pipeline.jobs["sub_node"]["settings"] = {}
171+
172+
pipeline_job_base = pipeline._to_rest_object()
173+
mock_method.return_value = pipeline_job_base
174+
mock_job_operation.get(name="random_name")
175+
150176
@patch.object(Job, "_from_rest_object")
151177
@patch.dict(os.environ, {AZUREML_PRIVATE_FEATURES_ENV_VAR: "True"})
152178
def test_get_private_preview_flag_returns_latest(self, mock_method, mock_job_operation: JobOperations) -> None:

0 commit comments

Comments
 (0)