Share via

Read/Write from/to Blob Storage in AzureML

Sep 1 Reputation point
Feb 15, 2021, 5:35 PM

I am using AzureML and I have a blob storage container, where I want read data from it and write data to it. Can I achieve that with the path that is being passed to the experiment as follows (from here):

from azureml.core import Workspace
ws: Workspace = Workspace.from_config()
compute_target: ComputeTarget = ws.compute_targets['<compute-target-name>']
ds: Datastore = ws.get_default_datastore()

data_ref = ds.path('<path/on/datastore>').as_mount()

config = ScriptRunConfig(
    source_directory='.',
    script='script.py',
    arguments=[str(data_ref)],               # returns environment variable $AZUREML_DATAREFERENCE_example_data
    compute_target=compute_target,
)

config.run_config.data_references[data_ref.data_reference_name] = data_ref.to_config()

If so, what is the purpose of OutputFileDatasetConfig class in the API? Is it just a convenient shortcut to the path in the container?

from azureml.data import OutputFileDatasetConfig

output = OutputFileDatasetConfig(folder, destination=(datastore_obj, path_to_folder))

arguments = [output]

Thanks

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,237 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 48,796 Reputation points Microsoft Employee
    Feb 16, 2021, 8:07 AM

    @Sep I think you can use this notebook to try the exact scenario as above.
    Output is configured to write the result back to the blob store under the configured folder. More options to configure the output can be seen by running 'help(OutputFileDatasetConfig)'

    Hope this helps!!

    0 comments No comments

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.