Skip to content

Commit

Permalink
update (#29080)
Browse files Browse the repository at this point in the history
  • Loading branch information
D-W- authored Mar 3, 2023
1 parent f4fab8e commit d67075e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ def _get_name_or_component_name(node: Union[BaseNode, AutoMLJob]):
if instance_id not in valid_component_ids:
continue
name = getattr(v, "name", None) or k
# for node name _, treat it as anonymous node with name unset
if name == "_":
continue
if name is not None:
name = name.lower()

Expand Down
59 changes: 59 additions & 0 deletions sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3034,3 +3034,62 @@ def pipeline(job_in_number: int, environment_variables: str):
pipeline_dict["jobs"]["hello_world_component"]["environment_variables"]
== "${{parent.inputs.environment_variables}}"
)

def test_node_name_underscore(self):
component_yaml = r"./tests/test_configs/components/helloworld_component_no_paths.yml"
component_func = load_component(source=component_yaml)

@dsl.pipeline()
def my_pipeline():
_ = component_func(component_in_number=1)

pipeline_job = my_pipeline()
assert pipeline_job.jobs.keys() == {"microsoftsamplescommandcomponentbasic_nopaths_test"}
assert (
pipeline_job.jobs["microsoftsamplescommandcomponentbasic_nopaths_test"].name
== "microsoftsamplescommandcomponentbasic_nopaths_test"
)

@dsl.pipeline()
def my_pipeline():
_ = component_func(component_in_number=1)
_ = component_func(component_in_number=2)

pipeline_job = my_pipeline()
assert pipeline_job.jobs.keys() == {
"microsoftsamplescommandcomponentbasic_nopaths_test",
"microsoftsamplescommandcomponentbasic_nopaths_test_1",
}

@dsl.pipeline()
def my_pipeline():
_ = component_func(component_in_number=1)
component_func(component_in_number=2)
_ = component_func(component_in_number=3)

pipeline_job = my_pipeline()
assert pipeline_job.jobs.keys() == {
"microsoftsamplescommandcomponentbasic_nopaths_test",
"microsoftsamplescommandcomponentbasic_nopaths_test_1",
"microsoftsamplescommandcomponentbasic_nopaths_test_2",
}

@dsl.pipeline()
def my_pipeline():
_ = component_func(component_in_number=1)
component_func(component_in_number=2)
_ = component_func(component_in_number=3)
node = component_func(component_in_number=4)

pipeline_job = my_pipeline()
assert pipeline_job.jobs.keys() == {"node", "node_1", "node_2", "node_3"}

@dsl.pipeline()
def my_pipeline():
node = component_func(component_in_number=1)
component_func(component_in_number=2)
_ = component_func(component_in_number=3)
component_func(component_in_number=4)

pipeline_job = my_pipeline()
assert pipeline_job.jobs.keys() == {"node", "node_1", "node_2", "node_3"}

0 comments on commit d67075e

Please sign in to comment.