Fix optional inputs with None/empty string values in job submissions #44651
Build #20260113.85 had test failures
Details
- Failed: 2,461 (12.84%)
- Passed: 14,696 (76.68%)
- Other: 2,009 (10.48%)
- Total: 19,166
Annotations
Check failure on line 6080 in Build log
azure-pipelines / python - pullrequest
Build log #L6080
PowerShell exited with code '1'.
Check failure on line 68815 in Build log
azure-pipelines / python - pullrequest
Build log #L68815
There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab.
Check failure on line 5749 in Build log
azure-pipelines / python - pullrequest
Build log #L5749
PowerShell exited with code '1'.
Check failure on line 73872 in Build log
azure-pipelines / python - pullrequest
Build log #L73872
There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab.
Check failure on line 1 in test_optional_inputs_with_none_and_empty_string
azure-pipelines / python - pullrequest
test_optional_inputs_with_none_and_empty_string
AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fa335e0d040>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fa335ea6060>}
+ where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fa335e0d040>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fa335ea6060>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7fa335ea4050>.inputs
+ where <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7fa335ea4050> = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.JobBase object at 0x7fa3348051d0>.properties
Raw output
self = <command_job.unittests.test_command_job_entity.TestCommandJobEntity object at 0x7fa33739e270>
def test_optional_inputs_with_none_and_empty_string(self) -> None:
"""Test that optional inputs with None or empty string values are not sent to REST API."""
# Test with None value - should be excluded from REST inputs
inputs_with_none = {
"required_input": "value1",
"optional_input": None,
}
command_job = CommandJob(
display_name="test-optional-inputs",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_none,
)
rest_obj = command_job._to_rest_object()
# None values should not be in the REST inputs
assert "required_input" in rest_obj.properties.inputs
assert "optional_input" not in rest_obj.properties.inputs
# Test with empty string value - should be excluded from REST inputs
inputs_with_empty_string = {
"required_input": "value1",
"optional_input": "",
}
command_job_empty = CommandJob(
display_name="test-optional-inputs-empty",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_empty_string,
)
rest_obj_empty = command_job_empty._to_rest_object()
# Empty string values should not be in the REST inputs
assert "required_input" in rest_obj_empty.properties.inputs
assert "optional_input" not in rest_obj_empty.properties.inputs
# Test with non-empty value - should be included in REST inputs
inputs_with_value = {
"required_input": "value1",
"optional_input": "value2",
}
command_job_value = CommandJob(
display_name="test-optional-inputs-value",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_value,
)
rest_obj_value = command_job_value._to_rest_object()
# Non-empty values should be in the REST inputs
assert "required_input" in rest_obj_value.properties.inputs
assert "optional_input" in rest_obj_value.properties.inputs
assert rest_obj_value.properties.inputs["optional_input"].value == "value2"
# Test with dict containing None value - should be excluded from REST inputs
inputs_with_dict_none = {
"required_input": "value1",
"optional_input": {"value": None},
}
command_job_dict_none = CommandJob(
display_name="test-optional-inputs-dict-none",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_dict_none,
)
rest_obj_dict_none = command_job_dict_none._to_rest_object()
# Dict with None value should not be in the REST inputs
assert "required_input" in rest_obj_dict_none.properties.inputs
> assert "optional_input" not in rest_obj_dict_none.properties.inputs
E AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fa335e0d040>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fa335ea6060>}
E + where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fa335e0d040>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fa335ea6060>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7fa335ea4050>.inputs
E + where <azure.ai.ml._restclient.v2025_01_
Check failure on line 1 in test_optional_inputs_with_none_and_empty_string
azure-pipelines / python - pullrequest
test_optional_inputs_with_none_and_empty_string
AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7f0fe74753f0>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7f0fe74740a0>}
+ where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7f0fe74753f0>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7f0fe74740a0>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7f0fe7474910>.inputs
+ where <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7f0fe7474910> = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.JobBase object at 0x7f0fe74745b0>.properties
Raw output
self = <command_job.unittests.test_command_job_entity.TestCommandJobEntity object at 0x7f0fe97552d0>
def test_optional_inputs_with_none_and_empty_string(self) -> None:
"""Test that optional inputs with None or empty string values are not sent to REST API."""
# Test with None value - should be excluded from REST inputs
inputs_with_none = {
"required_input": "value1",
"optional_input": None,
}
command_job = CommandJob(
display_name="test-optional-inputs",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_none,
)
rest_obj = command_job._to_rest_object()
# None values should not be in the REST inputs
assert "required_input" in rest_obj.properties.inputs
assert "optional_input" not in rest_obj.properties.inputs
# Test with empty string value - should be excluded from REST inputs
inputs_with_empty_string = {
"required_input": "value1",
"optional_input": "",
}
command_job_empty = CommandJob(
display_name="test-optional-inputs-empty",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_empty_string,
)
rest_obj_empty = command_job_empty._to_rest_object()
# Empty string values should not be in the REST inputs
assert "required_input" in rest_obj_empty.properties.inputs
assert "optional_input" not in rest_obj_empty.properties.inputs
# Test with non-empty value - should be included in REST inputs
inputs_with_value = {
"required_input": "value1",
"optional_input": "value2",
}
command_job_value = CommandJob(
display_name="test-optional-inputs-value",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_value,
)
rest_obj_value = command_job_value._to_rest_object()
# Non-empty values should be in the REST inputs
assert "required_input" in rest_obj_value.properties.inputs
assert "optional_input" in rest_obj_value.properties.inputs
assert rest_obj_value.properties.inputs["optional_input"].value == "value2"
# Test with dict containing None value - should be excluded from REST inputs
inputs_with_dict_none = {
"required_input": "value1",
"optional_input": {"value": None},
}
command_job_dict_none = CommandJob(
display_name="test-optional-inputs-dict-none",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_dict_none,
)
rest_obj_dict_none = command_job_dict_none._to_rest_object()
# Dict with None value should not be in the REST inputs
assert "required_input" in rest_obj_dict_none.properties.inputs
> assert "optional_input" not in rest_obj_dict_none.properties.inputs
E AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7f0fe74753f0>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7f0fe74740a0>}
E + where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7f0fe74753f0>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7f0fe74740a0>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7f0fe7474910>.inputs
E + where <azure.ai.ml._restclient.v2025_01_
Check failure on line 1 in test_optional_inputs_with_none_and_empty_string
azure-pipelines / python - pullrequest
test_optional_inputs_with_none_and_empty_string
AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fbef8f89590>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fbece14a3f0>}
+ where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fbef8f89590>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fbece14a3f0>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7fbece14a520>.inputs
+ where <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7fbece14a520> = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.JobBase object at 0x7fbef8e3a0d0>.properties
Raw output
self = <command_job.unittests.test_command_job_entity.TestCommandJobEntity object at 0x7fbef5f70670>
def test_optional_inputs_with_none_and_empty_string(self) -> None:
"""Test that optional inputs with None or empty string values are not sent to REST API."""
# Test with None value - should be excluded from REST inputs
inputs_with_none = {
"required_input": "value1",
"optional_input": None,
}
command_job = CommandJob(
display_name="test-optional-inputs",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_none,
)
rest_obj = command_job._to_rest_object()
# None values should not be in the REST inputs
assert "required_input" in rest_obj.properties.inputs
assert "optional_input" not in rest_obj.properties.inputs
# Test with empty string value - should be excluded from REST inputs
inputs_with_empty_string = {
"required_input": "value1",
"optional_input": "",
}
command_job_empty = CommandJob(
display_name="test-optional-inputs-empty",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_empty_string,
)
rest_obj_empty = command_job_empty._to_rest_object()
# Empty string values should not be in the REST inputs
assert "required_input" in rest_obj_empty.properties.inputs
assert "optional_input" not in rest_obj_empty.properties.inputs
# Test with non-empty value - should be included in REST inputs
inputs_with_value = {
"required_input": "value1",
"optional_input": "value2",
}
command_job_value = CommandJob(
display_name="test-optional-inputs-value",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_value,
)
rest_obj_value = command_job_value._to_rest_object()
# Non-empty values should be in the REST inputs
assert "required_input" in rest_obj_value.properties.inputs
assert "optional_input" in rest_obj_value.properties.inputs
assert rest_obj_value.properties.inputs["optional_input"].value == "value2"
# Test with dict containing None value - should be excluded from REST inputs
inputs_with_dict_none = {
"required_input": "value1",
"optional_input": {"value": None},
}
command_job_dict_none = CommandJob(
display_name="test-optional-inputs-dict-none",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_dict_none,
)
rest_obj_dict_none = command_job_dict_none._to_rest_object()
# Dict with None value should not be in the REST inputs
assert "required_input" in rest_obj_dict_none.properties.inputs
> assert "optional_input" not in rest_obj_dict_none.properties.inputs
E AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fbef8f89590>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fbece14a3f0>}
E + where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x7fbef8f89590>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x7fbece14a3f0>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x7fbece14a520>.inputs
E + where <azure.ai.ml._restclient.v2025_01_
Check failure on line 1 in test_optional_inputs_with_none_and_empty_string
azure-pipelines / python - pullrequest
test_optional_inputs_with_none_and_empty_string
AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x000000002907d910>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x000000002907d948>}
+ where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x000000002907d910>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x000000002907d948>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x000000002907d9b8>.inputs
+ where <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x000000002907d9b8> = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.JobBase object at 0x000000002907d980>.properties
Raw output
self = <command_job.unittests.test_command_job_entity.TestCommandJobEntity object at 0x000000001e9d8c28>
def test_optional_inputs_with_none_and_empty_string(self) -> None:
"""Test that optional inputs with None or empty string values are not sent to REST API."""
# Test with None value - should be excluded from REST inputs
inputs_with_none = {
"required_input": "value1",
"optional_input": None,
}
command_job = CommandJob(
display_name="test-optional-inputs",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_none,
)
rest_obj = command_job._to_rest_object()
# None values should not be in the REST inputs
assert "required_input" in rest_obj.properties.inputs
assert "optional_input" not in rest_obj.properties.inputs
# Test with empty string value - should be excluded from REST inputs
inputs_with_empty_string = {
"required_input": "value1",
"optional_input": "",
}
command_job_empty = CommandJob(
display_name="test-optional-inputs-empty",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_empty_string,
)
rest_obj_empty = command_job_empty._to_rest_object()
# Empty string values should not be in the REST inputs
assert "required_input" in rest_obj_empty.properties.inputs
assert "optional_input" not in rest_obj_empty.properties.inputs
# Test with non-empty value - should be included in REST inputs
inputs_with_value = {
"required_input": "value1",
"optional_input": "value2",
}
command_job_value = CommandJob(
display_name="test-optional-inputs-value",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_value,
)
rest_obj_value = command_job_value._to_rest_object()
# Non-empty values should be in the REST inputs
assert "required_input" in rest_obj_value.properties.inputs
assert "optional_input" in rest_obj_value.properties.inputs
assert rest_obj_value.properties.inputs["optional_input"].value == "value2"
# Test with dict containing None value - should be excluded from REST inputs
inputs_with_dict_none = {
"required_input": "value1",
"optional_input": {"value": None},
}
command_job_dict_none = CommandJob(
display_name="test-optional-inputs-dict-none",
command='echo "hello world"',
environment="AzureML-Minimal:1",
compute="cpu-cluster",
inputs=inputs_with_dict_none,
)
rest_obj_dict_none = command_job_dict_none._to_rest_object()
# Dict with None value should not be in the REST inputs
assert "required_input" in rest_obj_dict_none.properties.inputs
> assert "optional_input" not in rest_obj_dict_none.properties.inputs
E AssertionError: assert 'optional_input' not in {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x000000002907d910>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x000000002907d948>}
E + where {'optional_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.UriFolderJobInput object at 0x000000002907d910>, 'required_input': <azure.ai.ml._restclient.v2023_04_01_preview.models._models_py3.LiteralJobInput object at 0x000000002907d948>} = <azure.ai.ml._restclient.v2025_01_01_preview.models._models_py3.CommandJob object at 0x000000002907d9b8>.inputs
E + where <azure.ai.