Skip to main content

ArrayNode

This class represents a node that executes a target Flyte entity, such as a task or launch plan, over a collection of inputs in parallel. It manages execution constraints including concurrency limits and success thresholds, while automatically transforming the target's interface to handle list-based inputs and outputs. The class supports both local execution and remote workflow compilation for mapped operations.

Attributes

AttributeTypeDescription
targetUnion[LaunchPlan, ReferenceTask, "FlyteLaunchPlan"]The target Flyte entity to map over
idstringThe unique identifier for the node, derived from the target entity's name.
metadataOptional[_workflow_model.NodeMetadata]The metadata for the underlying node
namestringThe name of the target entity, used for node identification within the workflow.
python_interfaceflyte_interface.InterfaceThe transformed interface representing the list-based inputs and outputs for local execution.
interface_interface_models.TypedInterfaceThe transformed typed interface for remote entities, representing list-based inputs and outputs.
bindingsList[_literal_models.Binding] = []The list of input bindings that define how data is passed to the mapped task.
upstream_nodesList[Node] = []A list of nodes that must complete before this node can execute, which is empty for ArrayNodes.
flyte_entityAnyThe underlying Flyte entity (task or launch plan) that is being mapped.
data_mode_core_workflow.ArrayNode.DataModeDetermines how input data is partitioned, such as using a single input file or individual files.
min_success_ratioOptional[float] = 1.0The minimum ratio of successful executions.
min_successesOptional[int] = 0The minimum number of successful executions. If set, this takes precedence over min_success_ratio
concurrencyOptional[int]If specified, this limits the number of mapped tasks than can run in parallel to the given batch size.
execution_mode_core_workflow.ArrayNode.ExecutionModeDefines the state management strategy for the array node, such as FULL_STATE or MINIMAL_STATE.
is_original_sub_node_interfaceboolean = trueA boolean flag indicating if the node uses the original sub-node interface.
bound_inputsSet[string] = set()The set of input names that are bound to specific values rather than mapped over.

Constructor

Signature

def ArrayNode(
self,
target: Union[LaunchPlan, ReferenceTask, "FlyteLaunchPlan"],
bindings: Optional[List[_literal_models.Binding]] = None,
concurrency: Optional[int] = None,
min_successes: Optional[int] = None,
min_success_ratio: Optional[float] = None,
metadata: Optional[_workflow_model.NodeMetadata] = None,
): ...

Parameters

NameTypeDescription
targetUnion[LaunchPlan, ReferenceTask, FlyteLaunchPlan]The target Flyte entity to map over.
bindingsOptional[List[_literal_models.Binding]] = NoneA list of input bindings for the node.
concurrencyOptional[int] = NoneLimits the number of mapped tasks running in parallel. 0 means unbounded; None inherits from workflow.
min_successesOptional[int] = NoneThe minimum number of successful executions required. Takes precedence over min_success_ratio.
min_success_ratioOptional[float] = NoneThe minimum ratio of successful executions required (defaults to 1.0 if min_successes is not set).
metadataOptional[_workflow_model.NodeMetadata] = NoneMetadata for the underlying node.

Methods


construct_node_metadata()

def construct_node_metadata(self) -> _workflow_model.NodeMetadata: ...

Constructs the metadata for the node, defaulting to the target entity's name if no specific metadata is provided.

Returns

TypeDescription
_workflow_model.NodeMetadataThe metadata object used for node creation within a Flyte workflow.

name()

@property
def name(self) -> str: ...

Retrieves the name of the target Flyte entity associated with this node.

Returns

TypeDescription
strThe identifier string of the target entity.

python_interface()

@property
def python_interface(self) -> flyte_interface.Interface: ...

Provides the Python-native interface definition for the array node, which typically involves list-transformed inputs and outputs.

Returns

TypeDescription
flyte_interface.InterfaceThe Python interface representing the mapped execution signature.

interface()

@property
def interface(self) -> _interface_models.TypedInterface: ...

Retrieves the underlying typed interface model for the node, raising an error if the remote interface is not available.

Returns

TypeDescription
_interface_models.TypedInterfaceThe serialized interface model used for workflow compilation.

bindings()

@property
def bindings(self) -> List[_literal_models.Binding]: ...

Returns the list of input bindings that map workflow data to the node's inputs.

Returns

TypeDescription
List[_literal_models.Binding]A list of literal bindings defining how inputs are supplied to the node.

upstream_nodes()

@property
def upstream_nodes(self) -> List[Node]: ...

Identifies the nodes that must execute before this node; currently returns an empty list for ArrayNodes.

Returns

TypeDescription
List[Node]An empty list as upstream dependencies are managed at the workflow level.

flyte_entity()

@property
def flyte_entity(self) -> Any: ...

Returns the underlying Flyte entity (e.g., LaunchPlan or Task) that this node is mapping over.

Returns

TypeDescription
AnyThe target entity being executed in parallel.

data_mode()

@property
def data_mode(self) -> _core_workflow.ArrayNode.DataMode: ...

Indicates how data is transferred to the sub-tasks, such as via single or individual input files.

Returns

TypeDescription
_core_workflow.ArrayNode.DataModeThe data mode configuration for the array execution.

local_execute()

def local_execute(self, ctx: FlyteContext, **kwargs) -> Union[Tuple[Promise], Promise, VoidPromise]: ...

Simulates the array execution locally by iterating over input lists and invoking the target entity for each element. It validates success ratios and handles partial failures according to the node configuration.

Parameters

NameTypeDescription
ctxFlyteContextThe current execution context providing access to configuration and state.
kwargsAnyThe input values for the node, where mapped inputs are expected to be lists.

Returns

TypeDescription
Union[Tuple[Promise], Promise, VoidPromise]A promise containing a collection of results from the successful sub-task executions.

local_execution_mode()

def local_execution_mode(self): ...

Defines the execution state mode for local runs, indicating this is a local task execution.

Returns

TypeDescription
AnyThe local task execution mode constant.

min_success_ratio()

@property
def min_success_ratio(self) -> Optional[float]: ...

Returns the minimum ratio of successful sub-task executions required for the ArrayNode to be considered successful.

Returns

TypeDescription
Optional[float]A float between 0.0 and 1.0 representing the success threshold ratio.

min_successes()

@property
def min_successes(self) -> Optional[int]: ...

Returns the absolute minimum number of successful sub-task executions required.

Returns

TypeDescription
Optional[int]The integer count of required successful executions.

concurrency()

@property
def concurrency(self) -> Optional[int]: ...

Returns the maximum number of sub-tasks allowed to run in parallel.

Returns

TypeDescription
Optional[int]The parallelism limit, where 0 indicates unbounded concurrency.

execution_mode()

@property
def execution_mode(self) -> _core_workflow.ArrayNode.ExecutionMode: ...

Indicates the execution strategy for the array node, such as FULL_STATE or MINIMAL_STATE.

Returns

TypeDescription
_core_workflow.ArrayNode.ExecutionModeThe execution mode determined by the target entity type.

is_original_sub_node_interface()

@property
def is_original_sub_node_interface(self) -> bool: ...

Flags whether the node uses the original sub-node interface definition.

Returns

TypeDescription
boolAlways returns True for ArrayNode instances.

bound_inputs()

@property
def bound_inputs(self) -> Set[str]: ...

Returns the set of input names that are bound to specific values rather than mapped over.

Returns

TypeDescription
Set[str]An empty set as bound input support is currently not implemented.