Skip to content

Commit 92fbbd8

Browse files
authored
fix command job environment to support multiple data type (#41055)
1 parent 19bd600 commit 92fbbd8

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/parameterized_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ParameterizedCommandSchema(PathAwareSchema):
3131
environment = EnvironmentField(required=True)
3232
environment_variables = UnionField(
3333
[
34-
fields.Dict(keys=fields.Str(), values=fields.Str()),
34+
fields.Dict(),
3535
# Used for binding environment variables
3636
NestedField(InputLiteralValueSchema),
3737
]

sdk/ml/azure-ai-ml/tests/command_job/unittests/test_command_job_schema.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_deserialize_inputs(self):
8787

8888
def test_deserialize_inputs_dataset(self):
8989
test_path = "./tests/test_configs/command_job/command_job_inputs_dataset_test.yml"
90-
with open("./tests/test_configs/command_job/command_job_inputs_dataset_test.yml", "r") as f:
90+
with open(test_path, "r") as f:
9191
target = yaml.safe_load(f)
9292
with open(test_path, "r") as f:
9393
cfg = yaml.safe_load(f)
@@ -96,6 +96,7 @@ def test_deserialize_inputs_dataset(self):
9696
internal_representation: CommandJob = CommandJob(**schema.load(cfg))
9797
source = internal_representation._to_rest_object()
9898
assert source.properties.inputs["test1"].uri == target["inputs"]["test1"]["path"]
99+
assert source.properties.environment_variables == target["environment_variables"]
99100

100101
def test_deserialize_inputs_dataset_short_form(self):
101102
test_path = "./tests/test_configs/command_job/command_job_inputs_dataset_short_form_test.yml"

sdk/ml/azure-ai-ml/tests/test_configs/command_job/command_job_inputs_dataset_test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ environment: azureml:AzureML-sklearn-1.0-ubuntu20.04-py38-cpu:33
44
name: "test1"
55
compute: "azureml:testCompute"
66
experiment_name: mfe-test1
7+
environment_variables:
8+
env-str: test_value
9+
env-int: 1
10+
env-bool: true
11+
env-float: 1.0
712
properties:
813
test_property: test_value
914
inputs:

0 commit comments

Comments
 (0)