Skip to content
Draft
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
2 changes: 2 additions & 0 deletions sdk/ml/azure-ai-ml/azure/ai/ml/constants/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ class InputOutputModes:
"""Evaluation download asset type."""
DIRECT = "direct"
"""Direct asset type."""
HDFS = "hdfs"
"""HDFS asset type."""


class ConnectionTypes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
InputDeliveryMode.DIRECT: InputOutputModes.DIRECT,
InputDeliveryMode.EVAL_MOUNT: InputOutputModes.EVAL_MOUNT,
InputDeliveryMode.EVAL_DOWNLOAD: InputOutputModes.EVAL_DOWNLOAD,
"Hdfs": InputOutputModes.HDFS,
"hdfs": InputOutputModes.HDFS,
}

INPUT_MOUNT_MAPPING_TO_REST = {
Expand All @@ -79,6 +81,7 @@
InputOutputModes.EVAL_MOUNT: InputDeliveryMode.EVAL_MOUNT,
InputOutputModes.EVAL_DOWNLOAD: InputDeliveryMode.EVAL_DOWNLOAD,
InputOutputModes.DIRECT: InputDeliveryMode.DIRECT,
InputOutputModes.HDFS: "Hdfs",
}


Expand Down Expand Up @@ -249,7 +252,7 @@ def to_rest_dataset_literal_inputs(
input_data = LiteralJobInput(value=input_value.path)
# set mode attribute manually for binding job input
if input_value.mode:
input_data.mode = INPUT_MOUNT_MAPPING_TO_REST[input_value.mode]
input_data.mode = INPUT_MOUNT_MAPPING_TO_REST[input_value.mode.lower()]
if getattr(input_value, "path_on_compute", None) is not None:
input_data.pathOnCompute = input_value.path_on_compute
input_data.job_input_type = JobInputType.LITERAL
Expand Down Expand Up @@ -279,7 +282,8 @@ def to_rest_dataset_literal_inputs(
input_data = LiteralJobInput(value=str(input_value["value"]))
# set mode attribute manually for binding job input
if "mode" in input_value:
input_data.mode = input_value["mode"]
input_mode = str(input_value["mode"])
input_data.mode = INPUT_MOUNT_MAPPING_TO_REST.get(input_mode.lower(), input_mode)
else:
input_data = LiteralJobInput(value=str(input_value))
input_data.job_input_type = JobInputType.LITERAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
from azure.ai.ml.entities._inputs_outputs import Input, Output
from azure.ai.ml.entities._job._input_output_helpers import (
INPUT_MOUNT_MAPPING_FROM_REST,
from_rest_inputs_to_dataset_literal,
to_rest_dataset_literal,
validate_pipeline_input_key_characters,
)
from azure.ai.ml.entities._job.automl.search_space_utils import _convert_sweep_dist_dict_to_str_dict
Expand All @@ -53,6 +55,24 @@
@pytest.mark.unittest
@pytest.mark.pipeline_test
class TestPipelineJobSchema:
def test_hdfs_input_mode_round_trip(self):
rest_inputs = to_rest_dataset_literal(
{
"hdfs_input": Input(
type=AssetTypes.URI_FOLDER,
path="azureml://datastores/workspaceblobstore/paths/data/",
mode=InputOutputModes.HDFS,
)
},
job_type=None,
)

assert rest_inputs["hdfs_input"].mode == "Hdfs"

sdk_inputs = from_rest_inputs_to_dataset_literal(rest_inputs)
assert isinstance(sdk_inputs["hdfs_input"], Input)
assert sdk_inputs["hdfs_input"].mode == InputOutputModes.HDFS

def test_validate_pipeline_job_keys(self):
def validator(key, assert_valid=True):
if assert_valid:
Expand Down
Loading