OutputPortBinding class

Definition

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.

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)
Inheritance
builtins.object
OutputPortBinding

Parameters

name
str

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

datastore
AbstractAzureStorageDatastore or AzureDataLakeDatastore

Datastore the PipelineData will reside on.

output_name
str

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

bind_mode
str

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

path_on_compute
str

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

is_directory
bool

Whether the output is a directory or single file.

overwrite
bool

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

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.

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.

training_output
TrainingOutput, optional

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.

dataset_registration
DatasetRegistration

Optional. If set will register the output as an Azure Machine Learning Dataset which will be consumed as a Dataset as well.

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") the producing step will use to create the data.

Returns

The bind mode.

Return type

str

data_type

Get the type of data which will be produced.

Returns

The data type name.

Return type

str

dataset_registration

Get the dataset registration information.

Returns

The dataset registration information.

Return type

datastore

Datastore the PipelineData will reside on.

Returns

The Datastore object.

Return type

is_directory

Whether the output is a directory.

Returns

is_directory

Return type

name

Name of the OutputPortBinding object.

Returns

The name.

Return type

str

overwrite

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

Returns

_overwrite

Return type

path_on_compute

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

Returns

path_on_compute

Return type

str

pipeline_output_name

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

Returns

The pipeline output name.

Return type

str

training_output

Get training output.

Returns

Training output

Return type