Can Azure ML components write to dynamic outputs?

Dance, Cody R. (ALT) 35 Reputation points
2023-04-26T19:05:41.8233333+00:00

In the Azure ML SDK v2, is it possible to have a component that writes to different locations in Blob storage based on it's input?

Here is the only way I could think to arrange this (see path in the outputs variable), but it doesn't work. I don't think the ${{inputs.output_datastore}} and ${{inputs.output_path}} are accessible in the outputs definition.

save_result_component = command(
    name="save_result_component",
    display_name="Save Result Component",
    description="Saves data at input_path to output_path in output_datastore",
    inputs={
        "input_path": Input(type="uri_file"),
        "output_datastore": Input(type="string"),
        "output_path": Input(type='string')
    },
    outputs=dict(
        output_path=Output(type="uri_file",
                           mode="rw_mount",
                           path="azureml://datastores/${{inputs.output_datastore}}/paths/${{inputs.output_path}}")
    ),
    # The source folder of the component
    code='./save_result',
    command="""python save_result.py \
            --input_path ${{inputs.input_path}} --output_path ${{outputs.output_path}} \
            """,
    environment="azureml:ffm_env:4",
)


Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,917 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,859 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.