Graph Class

A class to define a pipeline run graph.

Initialize Graph.

Inheritance
builtins.object
Graph

Constructor

Graph(name, context)

Parameters

Name Description
name
Required
str

Name of the graph.

context
Required
<xref:azureml.pipeline.core._GraphContext>

The current graph context.

name
Required
str

Name of the graph.

context
Required
<xref:azureml.pipeline.core._GraphContext>

The current graph context.

Methods

add_datasource_node

Add a datasource node to the graph.

add_module_node

Add a module node to the graph.

connect

Connect two ports and creates an Edge.

delete_node

Delete a node from the graph.

finalize

Finalize resources for nodes in the graph.

generate_yaml

Generate the yaml representation of the graph.

get_node

Get a node by ID.

sequence

Configure a list of nodes to run in a sequence following the first node in the list.

submit

Submit the graph to run in the cloud.

validate

Validate graph. Returns a list of errors.

add_datasource_node

Add a datasource node to the graph.

add_datasource_node(name, datasource=None, datasource_builder=None, datapath_param_name=None)

Parameters

Name Description
name
Required
str

Name of the node.

datasource

Datasource for this node.

Default value: None
datasource_builder
<xref:azureml.pipeline.core._DatasourceBuilder>

_DatasourceBuilder for this node.

Default value: None
datapath_param_name
str

Datapath parameter name.

Default value: None

Returns

Type Description

node

add_module_node

Add a module node to the graph.

add_module_node(name, input_bindings, output_bindings=None, param_bindings=None, module=None, module_builder=None, module_wiring=None, runconfig=None, cloud_settings=None)

Parameters

Name Description
name
Required
str

Name of the node

input_bindings
Required

List of input port bindings.

output_bindings

List of output port bindings.

Default value: None
param_bindings

Dictionary of name-value pairs for parameter assignments.

Default value: None
module

Module for this node

Default value: None
module_builder
<xref:azureml.pipeline.core._ModuleBuilder>

_ModuleBuilder for this node

Default value: None
module_wiring

A mapping between the node's inputs/outputs and the module inputs/outputs. Holds two keys, inputs and outputs, each mapped to a dict whose keys are the module's inputs/outputs names, and the values are the node's ports.

Default value: None
runconfig
str

Runconfig that will be used for python_script_step

Default value: None
cloud_settings
<xref:azureml.pipeline.core._restclients.aeva.models.CloudSettings>

Settings that will be used for clouds

Default value: None

Returns

Type Description

node

connect

Connect two ports and creates an Edge.

connect(source_port, dest_port)

Parameters

Name Description
source_port
Required

Output port from the node that is the source of the connection

dest_port
Required

Input port from the node that is the destination of the connection

Returns

Type Description

edge

delete_node

Delete a node from the graph.

delete_node(node_id)

Parameters

Name Description
node_id
Required
str

node id

finalize

Finalize resources for nodes in the graph.

finalize(dry_run=None, regenerate_outputs=False)

Parameters

Name Description
dry_run

Set to True to verify that the graph can be built without making any external API calls to Azure ML service.

Default value: None
regenerate_outputs

Set to True to force a new run (disallows module/datasource reuse).

Default value: False

Returns

Type Description

Dictionary of {node_id, (resource_id, is_new_resource)}

generate_yaml

Generate the yaml representation of the graph.

generate_yaml()

Returns

Type Description

Return the yaml dict

get_node

Get a node by ID.

get_node(node_id)

Parameters

Name Description
node_id
Required
str

The node ID.

Returns

Type Description

The node.

sequence

Configure a list of nodes to run in a sequence following the first node in the list.

sequence(nodes)

Parameters

Name Description
nodes
Required

The list of nodes.

submit

Submit the graph to run in the cloud.

submit(pipeline_parameters=None, continue_on_step_failure=False, regenerate_outputs=False, parent_run_id=None, **kwargs)

Parameters

Name Description
pipeline_parameters

Parameters for pipeline execution. Optional.

Default value: None
continue_on_step_failure

Indicates whether to let the experiment continue executing if one step fails. If True, only steps that have no dependency on the output of the failed step will continue execution.

Default value: False
regenerate_outputs

Set to True to force a new run (disallows module/datasource reuse)

Default value: False
parent_run_id

Optional run ID to set for the parent run of this pipeline run, which is reflected in RunHistory. The parent run must belong to same experiment as this pipeline is being submitted to.

Default value: None
kwargs
Required

Custom keyword arguments, reserved for future development.

Returns

Type Description

A PipelineRun.

validate

Validate graph. Returns a list of errors.

validate()

Returns

Type Description

List errors.

Attributes

datasource_nodes

Get a list containing all datasource nodes.

Returns

Type Description

List of Node

edges

Get an iterator of edges.

Returns

Type Description

a list of Edge

module_nodes

Get a list containing all module nodes.

Returns

Type Description

List of Node

node_dict

Get a dictionary containing all nodes.

Returns

Type Description

Dictionary of {node Id, Node}

node_name_dict

Get a dictionary containing all nodes indexed by name.

Returns

Type Description

Dictionary of {node name, Node}

nodes

Get a list containing all nodes.

Returns

Type Description

List of Node

params

Get a dictionary containing all graph parameters. Values are literal types or data reference as JSON string.

Returns

Type Description

Dictionary of {param name, param value}