StepRun should inherit Run's .download_files() method
I have a PipelineRun for which I'd like to loop though all the StepRuns to download all the artifacts saved to the "outputs" dir. There are many outputs, I'd rather not specify each file for each StepRun...
run_step = PipelineRun(exp, '9b13e0de-fa27-454a-84e1-204aa0037ea0')
this works
run_step.download_file(name = "outputs/data.pkl", output_file_path = 'c:\\temp\\test-artifacts')
but this doesn't
run_step.download_files(output_file_paths = 'c:\\temp\\test-artifacts')
Traceback (most recent call last):
File "download_files.py", line 33, in <module>
run_step.download_files(output_file_path = 'c:\\temp\\test-artifacts')
AttributeError: 'PipelineRun' object has no attribute 'download_files'
@sanpil @akshay-0 maybe I'm off target because I can use StepRun.get_outputs() (see below), but it strikes me as not ideal because:
- It makes a mess of directories I have to navigate to pull out the files, and I don't want every file, just a subset.
- To view and download these files through the portal I'd have to also save these files to
"./outputs"
for output in run_step.get_outputs():
(run_step
.get_output(output)
.get_port_data_reference()
.download('c:\\temp\\test-artifacts', overwrite = True, show_progress = True)
)
All the bugs aside, I'm most looking forward to work with you to figure best practice for persistent data storage and access for Pipeline data.
Looking.
you can try:
run.download_files(prefix='', output_directory = 'c:\\temp\\test-artifacts')
Note that you can specify filepath prefix for any subset of atifacts. But prefix='' is needed atm to download all artifacts.
For more details on download_files.
@sonnypark did you catch that the run object is a StepRun class, not a Run class? The method works no problem for me with the Run class. My issue is with the StepRun class
that was pipeline run since I found it from your error log: 'PipelineRun' object has no attribute 'download_files' But it should work for both PipelineRun and StepRun. If you still see any errors with correct parameter names (prefix and output_dictectory), error details would be helpful to investigate.
Also worth noting that we're on version 1.0.10 of the SDK right now.
pylint is throwing the same error.
AttributeError Traceback (most recent call last)
~\Documents\attrition\download_files.py in <module>
85 # )
86 for run in [run_join, run_batch_score]:
---> 87 run.download_files(prefix='', output_directory=output_path, overwrite = True, show_progress = True)
AttributeError: 'StepRun' object has no attribute 'download_files'
I found download_files has been added around Mar. I do not think 1.0.10 has download_files.
Please upgrade to a more recent version of the azureML Python SDK.
@danielsc @j-martens if this is in the Python SDK, shouldn't it also be listed as a method in the docs? https://docs.microsoft.com/en-us/python/api/azureml-pipeline-core/azureml.pipeline.core.steprun?view=azure-ml-py#methods
StepRun is a Run. You will see the method in the Run doc:

This link here was sensational for downloading files.
Before you can download files on the step you are required to wait for completion of the Step, which is different to waiting for completion of the Run.
step_run = pipeline_run.find_step_run("train")[0]
step_finished = run_object.wait_for_completion()['status']
file_names = step_run.get_file_names()
print(step_run.get_file_names())
for file in file_names:
run.download_files(prefix='', output_directory='./outputs/')
Did the trick for me.