Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ def _to_rest_object(self, **kwargs: Any) -> dict:
"limits": get_rest_dict_for_node_attrs(self.limits, clear_empty_value=True),
"resources": get_rest_dict_for_node_attrs(self.resources, clear_empty_value=True),
"services": get_rest_dict_for_node_attrs(self.services),
"identity": self.identity._to_dict() if self.identity and not isinstance(self.identity, Dict) else None,
"identity": get_rest_dict_for_node_attrs(self.identity),
"queue_settings": get_rest_dict_for_node_attrs(self.queue_settings, clear_empty_value=True),
}.items():
if value is not None:
Expand Down Expand Up @@ -818,7 +818,7 @@ def _from_rest_object_to_init_params(cls, obj: dict) -> Dict:
obj["limits"] = CommandJobLimits._from_rest_object(obj["limits"])

if "identity" in obj and obj["identity"]:
obj["identity"] = _BaseJobIdentityConfiguration._load(obj["identity"])
obj["identity"] = _BaseJobIdentityConfiguration._from_rest_object(obj["identity"])

if "queue_settings" in obj and obj["queue_settings"]:
obj["queue_settings"] = QueueSettings._from_rest_object(obj["queue_settings"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,7 @@ def _to_rest_object(self, **kwargs: Any) -> dict:
"partition_keys": json.dumps(self.partition_keys)
if self.partition_keys is not None
else self.partition_keys,
"identity": self.identity._to_dict()
if self.identity and not isinstance(self.identity, Dict)
else None,
"identity": get_rest_dict_for_node_attrs(self.identity),
"resources": get_rest_dict_for_node_attrs(self.resources),
}
)
Expand Down Expand Up @@ -481,9 +479,8 @@ def _from_rest_object_to_init_params(cls, obj: dict) -> Dict:

if "partition_keys" in obj and obj["partition_keys"]:
obj["partition_keys"] = json.dumps(obj["partition_keys"])

if "identity" in obj and obj["identity"]:
obj["identity"] = _BaseJobIdentityConfiguration._load(obj["identity"])
obj["identity"] = _BaseJobIdentityConfiguration._from_rest_object(obj["identity"])
return obj

def _build_inputs(self) -> Dict:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,7 @@ def pipeline_with_default_component():
created_pipeline_job: PipelineJob = client.jobs.get(pipeline_job.name)
assert created_pipeline_job.jobs["node1"].component == f"{component_name}@default"

@pytest.mark.skip("Will renable when parallel e2e recording issue is fixed")
def test_pipeline_node_identity_with_component(self, client: MLClient):
path = "./tests/test_configs/components/helloworld_component.yml"
component_func = load_component(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ def test_pipeline_node_identity_with_builder(self, test_command_params):
test_command_params["identity"] = UserIdentityConfiguration()
command_node = command(**test_command_params)
rest_dict = command_node._to_rest_object()
assert rest_dict["identity"] == {"type": "user_identity"}
assert rest_dict["identity"] == {"identity_type": "UserIdentity"}

@pipeline
def my_pipeline():
Expand All @@ -1063,7 +1063,7 @@ def my_pipeline():
"display_name": "my-fancy-job",
"distribution": {"distribution_type": "Mpi", "process_count_per_instance": 4},
"environment_variables": {"foo": "bar"},
"identity": {"type": "user_identity"},
"identity": {"identity_type": "UserIdentity"},
"inputs": {
"boolean": {"job_input_type": "literal", "value": "False"},
"float": {"job_input_type": "literal", "value": "0.01"},
Expand Down
6 changes: 3 additions & 3 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 @@ -1983,7 +1983,7 @@ def pipeline_func(component_in_path):

assert actual_dict["jobs"] == {
"node1": {
"identity": {"type": "aml_token"},
"identity": {"identity_type": "AMLToken"},
"inputs": {
"component_in_number": {"job_input_type": "literal", "value": "1"},
"component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"},
Expand All @@ -1992,7 +1992,7 @@ def pipeline_func(component_in_path):
"type": "command",
},
"node2": {
"identity": {"type": "user_identity"},
"identity": {"identity_type": "UserIdentity"},
"inputs": {
"component_in_number": {"job_input_type": "literal", "value": "1"},
"component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"},
Expand All @@ -2001,7 +2001,7 @@ def pipeline_func(component_in_path):
"type": "command",
},
"node3": {
"identity": {"type": "managed_identity"},
"identity": {"identity_type": "Managed"},
"inputs": {
"component_in_number": {"job_input_type": "literal", "value": "1"},
"component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.component_in_path}}"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,7 @@ def pipeline(job_data_path):
"value": "${{parent.outputs.pipeline_job_out}}",
}
},
"identity": {"type": "user_identity"},
"identity": {"identity_type": "UserIdentity"},
"resources": {"instance_count": 2},
"task": {
"code": parse_local_path(
Expand Down Expand Up @@ -2016,7 +2016,7 @@ def pipeline(path):
"display_name": "my-evaluate-job",
"environment_variables": {"key": "val"},
"error_threshold": 1,
"identity": {"type": "user_identity"},
"identity": {"identity_type": "UserIdentity"},
"input_data": "${{inputs.job_data_path}}",
"inputs": {
"job_data_path": {
Expand Down Expand Up @@ -2052,7 +2052,7 @@ def pipeline(path):
"display_name": "my-evaluate-job",
"environment_variables": {"key": "val"},
"error_threshold": 1,
"identity": {"type": "user_identity"},
"identity": {"identity_type": "UserIdentity"},
"input_data": "${{inputs.job_data_path}}",
"inputs": {
"job_data_path": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ def test_pipeline_job_with_multiple_parallel_job(self, client: MLClient, randstr
# assert on the number of converted jobs to make sure we didn't drop the parallel job
assert len(created_job.jobs.items()) == 3

@pytest.mark.skip("Will renable when parallel e2e recording issue is fixed")
def test_pipeline_job_with_command_job_with_dataset_short_uri(
self, client: MLClient, randstr: Callable[[str], str]
) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ def test_pipeline_node_with_identity(self):
assert actual_dict["jobs"] == {
"hello_world_component": {
"computeId": "cpu-cluster",
"identity": {"type": "user_identity"},
"identity": {"identity_type": "UserIdentity"},
"inputs": {
"component_in_number": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_number}}"},
"component_in_path": {"job_input_type": "literal", "value": "${{parent.inputs.job_in_path}}"},
Expand All @@ -1994,7 +1994,7 @@ def test_pipeline_node_with_identity(self):
},
"hello_world_component_2": {
"computeId": "cpu-cluster",
"identity": {"type": "aml_token"},
"identity": {"identity_type": "AMLToken"},
"inputs": {
"component_in_number": {
"job_input_type": "literal",
Expand All @@ -2007,7 +2007,7 @@ def test_pipeline_node_with_identity(self):
},
"hello_world_component_3": {
"computeId": "cpu-cluster",
"identity": {"type": "user_identity"},
"identity": {"identity_type": "UserIdentity"},
"inputs": {
"component_in_number": {
"job_input_type": "literal",
Expand Down