No flag to set overwrite=True in Dataset for accessing from datalake for use in distributed environment
Environment: azureml-core==1.12.0, azureml-dataprep==2.0.7 Python Version = 3.7: PyTorch 1.4 AMLCompute cluster Standard_NC12
Output from failed method (path made generic): Dataset initialization failed: UserErrorException: Message: File "/mnt/location/dataset.json" already exists. Set overwrite=True to overwrite it. InnerException None ErrorResponse { "error": { "code": "UserError", "message": "File "/mnt/location/dataset.json" already exists. Set overwrite=True to overwrite it." } }
How the input dataset being referenced was created: registered_dataset = Dataset.get_by_name(workspace=ws, name=kwargs['dataset_name']) dataset_as_named_input = registered_dataset.as_named_input(name=kwargs['dataset_name']) input_dataset = dataset_as_named_input.as_download(path_on_compute='./outputs/data')
Problem: there is no overwrite flag to set according to docs
Also filed bug on Azure-sdk-for-python
Hi @kwhitehall
Thanks for reporting. This is a bug that we will fix in the next few releases. For now, as a workaround:
if you want to download data to a specific path on the compute, you can pass in dataset as direct and call download in your script:
dataset_as_named_input = registered_dataset.as_named_input(name=kwargs['dataset_name'])
input_dataset = dataset_as_named_input
from azureml.core import Run
# dataset object from the run
run = Run.get_context()
dataset = run.input_datasets[''dataset_name'']
dataset.download(path_on_compute='./outputs/data', overwrite=True)
if you dont need to download data to a specified path on compute, your script without specifying path_on_compute will work.
Thank you @MayMSFT for the ack and workaround.
#please-close