PortDataReference Class
Models data associated with an output of a completed StepRun.
A PortDataReference object can be used to download the output data which was produced by a StepRun. It can also be used as an step input in a future Pipeline.
Initialize PortDataReference.
- Inheritance
-
builtins.objectPortDataReference
Constructor
PortDataReference(context, pipeline_run_id, data_reference, step_run=None)
Parameters
- context
- <xref:azureml.pipeline.core._GraphContext>
The graph context object.
- context
- <xref:azureml.pipeline.core._GraphContext>
The graph context object.
Remarks
A PortDataReference points to data which was produced by a completed StepRun.
Get a PortDataReference from a PipelineRun and download the output data as follows:
from azureml.pipeline.core import PipelineRun, StepRun, PortDataReference
pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
step_run = pipeline_run.find_step_run("<node_name>")[0]
port_data_reference = step_run.get_output_data("<output_name>")
port_data_reference.download(local_path="path")
A PortDataReference can be used as an input to a step in a Pipeline, similar to using a DataReference.
An example to using a PortDataReference as a step input is as follows:
from azureml.pipeline.core import PortDataReference, Pipeline, PipelineRun
from azureml.pipeline.steps import PythonScriptStep
pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
step_run = pipeline_run.find_step_run("<node_name>")[0]
port_data_reference = step_run.get_output_data("<output_name>")
step_1 = PythonScriptStep(
name='train',
script_name="train.py",
compute_target=compute,
arguments=["--input", port_data_reference],
inputs=[port_data_reference]
)
pipeline = Pipeline(workspace=workspace, steps=[step_1])
In this example, the newly constructed Pipeline will use the output which was created by the completed PipelineRun as an input to the train step.
Methods
as_download |
Consume the PortDataReference as a step input through the "download" mode. |
as_input |
Create an InputPortBinding and specify an input name (but use default mode). |
as_mount |
Consume the PortDataReference as a step input through the "mount" mode. |
create_input_binding |
Create input binding with this PortDataReference as the source. |
download |
Download the data represented by the PortDataReference. |
as_download
Consume the PortDataReference as a step input through the "download" mode.
as_download(input_name=None, path_on_compute=None, overwrite=None)
Parameters
Returns
The InputPortBinding with this PortDataReference as the source.
Return type
as_input
Create an InputPortBinding and specify an input name (but use default mode).
as_input(input_name)
Parameters
Returns
The InputPortBinding with this PortDataReference as the source.
Return type
as_mount
Consume the PortDataReference as a step input through the "mount" mode.
as_mount(input_name=None)
Parameters
Returns
The InputPortBinding with this PortDataReference as the source.
Return type
create_input_binding
Create input binding with this PortDataReference as the source.
create_input_binding(input_name=None, mode=None, path_on_compute=None, overwrite=None)
Parameters
- path_on_compute
- str
For "download" mode, the path on the compute the data will reside.
Returns
The InputPortBinding with this PortDataReference as the source.
Return type
download
Download the data represented by the PortDataReference.
download(local_path, overwrite=None, show_progress=None)
Parameters
- show_progress
- bool
Show the progress of download in the console, defaults to True.
Returns
The number of files successfully downloaded.
Return type
Attributes
datastore
Get the Datastore associated with the PortDataReference.
Returns
The datastore object.
Return type
datastore_name
Get the name of the Datastore associated with the PortDataReference.
Returns
The datastore name.
Return type
name
path_on_datastore
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for