OutputPortBinding Class

Defines a named output of a pipeline step.

OutputPortBinding can be used to specify the type of data which will be produced by a step and how the data will be produced. It can be used with InputPortBinding to specify that the step output is a required input of another step.

Initialize OutputPortBinding.

Inheritance
builtins.object
OutputPortBinding

Constructor

OutputPortBinding(name, datastore=None, output_name=None, bind_mode='mount', path_on_compute=None, is_directory=None, overwrite=None, data_type=None, pipeline_output_name=None, training_output=None, dataset_registration=None, dataset_output=None)

Parameters

Name Description
name
Required
str

Name of the OutputPortBinding object, which can contain only letters, digits, and underscores.

datastore

Datastore the PipelineData will reside on.

Default value: None
output_name
str

Name of the output, if None name is used. Can contain only letters, digits, and underscores.

Default value: None
bind_mode
str

Specifies whether the producing step will use "upload" or "mount" or "hdfs" method to access the data.

Default value: mount
path_on_compute
str

For "upload" mode, the path the module writes the output to.

Default value: None
is_directory

Whether the output is a directory or single file.

Default value: None
overwrite

For "upload" mode, whether to overwrite existing data.

Default value: None
data_type
str

Optional. Data type can be used to specify the expected type of the output and to detail how consuming steps should use the data. Can be any user-defined string.

Default value: None
pipeline_output_name
str

If provided this output will be available by using PipelineRun.get_pipeline_output(). Pipeline output names must be unique in the pipeline.

Default value: None
training_output

Defines output for training result. This is needed only for specific trainings which result in different kinds of outputs such as Metrics and Model. For example, AutoMLStep results in metrics and model. You can also define specific training iteration or metric used to get best model. For HyperDriveStep, you can also define the specific model files to be included in the output.

Default value: None
dataset_registration

Optional. This is an internal parameter. You should be using PipelineData.as_dataset instead.

Default value: None
dataset_output

Optional. This is an internal parameter. You should be using OutputFileDatasetConfig intead.

Default value: None
name
Required
str

Name of the OutputPortBinding object, which can contain only letters, digits, and underscores.

datastore
Required

Datastore the PipelineData will reside on.

output_name
Required
str

Name of the output, if None name is used. Can only contain letters, digits, and underscores.

bind_mode
Required
str

Specifies whether the producing step will use "upload" or "mount" or "hdfs" method to access the data.

path_on_compute
Required
str

For "upload" mode, the path the module writes the output to.

is_directory
Required

if output is a directory

overwrite
Required

For "upload" mode, whether to overwrite existing data.

data_type
Required
str

Optional. Data type can be used to specify the expected type of the output and to detail how consuming steps should use the data. Can be any user-defined string.

pipeline_output_name
Required
str

If provided this output will be available by using PipelineRun.get_pipeline_output(). Pipeline output names must be unique in the pipeline.

training_output
Required

Defines output for training result. This is needed only for specific trainings which result in different kinds of outputs such as Metrics and Model. For example, AutoMLStep results in metrics and model. You can also define specific training iteration or metric used to get best model. For HyperDriveStep, you can also define the specific model files to be included in the output.

dataset_registration
Required

Optional. This is an internal parameter. You should be using PipelineData.as_dataset instead.

dataset_output
Required

Optional. This is an internal parameter. You should be using OutputFileDatasetConfig intead.

Remarks

OutputPortBinding can be used in a similar way as PipelineData when building a Pipeline to specify step inputs and outputs. The difference is OutputPortBinding needs to be used with InputPortBinding in order to be consumed as an input to another step.

An example to construct a Pipeline with OutputPortBinding is as follows:


   from azureml.pipeline.core import OutputPortBinding, InputPortBinding, Pipeline
   from azureml.pipeline.steps import PythonScriptStep

   step_1_output = OutputPortBinding("output", datastore=datastore)

   step_1 = PythonScriptStep(
       name='process data',
       script_name="process_data.py",
       compute_target=compute,
       arguments=["--output", step_1_output],
       outputs=[step_1_output]
   )

   step_2_input = InputPortBinding("input", bind_object=step_1_output)

   step_2 = PythonScriptStep(
       name='train',
       script_name="train.py",
       compute_target=compute,
       arguments=["--input", step_2_input],
       inputs=[step_2_input]
   )

   pipeline = Pipeline(workspace=workspace, steps=[step_1, step_2])

This will create a Pipeline with two steps. The process step will be executed first, then after it has completed, the train step will be executed. Azure ML will provide the output produced by the process step, as described by the OutputPortBinding object, to the train step.

Attributes

bind_mode

Get the mode ("upload" or "mount" or "hdfs") the producing step will use to create the data.

Returns

Type Description
str

The bind mode.

data_type

Get the type of data which will be produced.

Returns

Type Description
str

The data type name.

dataset_registration

Get the dataset registration information.

Returns

Type Description

The dataset registration information.

datastore

Datastore the PipelineData will reside on.

Returns

Type Description

The Datastore object.

is_directory

Whether the output is a directory.

Returns

Type Description

is_directory

name

Name of the OutputPortBinding object.

Returns

Type Description
str

The name.

overwrite

For "upload" mode, indicate whether to overwrite existing data.

Returns

Type Description

_overwrite

path_on_compute

For "upload" mode, the path the module writes the output to.

Returns

Type Description
str

path_on_compute

pipeline_output_name

Get the name of the pipeline output corresponding to this OutputPortBinding.

Returns

Type Description
str

The pipeline output name.

training_output

Get training output.

Returns

Type Description

Training output