Skip to main content

ArrayNode

This class represents a node that executes a target Flyte entity, such as a launch plan or task, over a collection of inputs in an array-like fashion. It provides mechanisms to control execution through concurrency limits and success thresholds, supporting both minimum success counts and ratios. The class automatically transforms the target's interface to handle list-based inputs and outputs while managing data and execution modes based on the target entity type.

Attributes

AttributeTypeDescription
targetUnion[LaunchPlan, ReferenceTask, FlyteLaunchPlan]The target Flyte entity to map over
idstringUnique identifier for the node, derived from the target entity's name.
metadataNodeMetadataThe metadata for the underlying node
concurrencyintegerIf specified, this limits the number of mapped tasks than can run in parallel to the given batch size.
min_successesintegerThe minimum number of successful executions. If set, this takes precedence over min_success_ratio
min_success_ratiofloat = 1.0The minimum ratio of successful executions.
bindingsList[Binding] = []A list of input bindings that map workflow data to the node's interface.
python_interfaceInterfaceThe transformed Python interface representing the collection-based inputs and outputs of the array node.
interfaceTypedInterfaceThe transformed backend-compatible interface for remote entities.
data_modeArrayNode.DataModeDetermines how input data is partitioned, such as using a single input file or individual files per map instance.
execution_modeArrayNode.ExecutionModeDefines the state management strategy for the node, such as FULL_STATE or MINIMAL_STATE.

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 that can run in parallel. Set to 0 for unbounded concurrency.
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 and returns 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 containing configuration for the workflow node.

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 object describing the expected input and output types.

interface()

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

Retrieves the serialized typed interface for remote entities; raises an AttributeError if the interface is not available.

Returns

TypeDescription
_interface_models.TypedInterfaceThe low-level typed interface used for serialization and remote execution.

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 binding models representing the input connections.

upstream_nodes()

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

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

Returns

TypeDescription
List[Node]An empty list of upstream node dependencies.

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 Flyte entity object.

data_mode()

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

Indicates how data is passed to the sub-nodes, such as using single or individual input files.

Returns

TypeDescription
_core_workflow.ArrayNode.DataModeThe data mode enum value determining input file handling.

local_execute()

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

Executes the array node 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 execution context providing environment settings and literal translation utilities.
kwargsAnyThe keyword arguments representing the input values for the mapped execution.

Returns

TypeDescription
Union[Tuple[Promise], Promise, VoidPromise]A promise containing a collection of results from the mapped executions, or a VoidPromise if no outputs are expected.

local_execution_mode()

def local_execution_mode(self): ...

Returns the execution mode for local runs, identifying this as a local task execution.

Returns

TypeDescription
ExecutionState.ModeThe local task execution mode constant.

min_success_ratio()

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

Retrieves the minimum ratio of successful sub-node executions required for the ArrayNode to be considered successful.

Returns

TypeDescription
Optional[float]A float between 0 and 1, or None if min_successes is used instead.

min_successes()

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

Retrieves the absolute minimum number of successful sub-node executions required.

Returns

TypeDescription
Optional[int]The integer count of required successes, or 0 if ratio-based success is active.

concurrency()

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

Retrieves the maximum number of mapped tasks allowed to run in parallel.

Returns

TypeDescription
Optional[int]The batch size for parallel execution, or None if inheriting from the workflow.

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 enum value.

is_original_sub_node_interface()

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

Returns a boolean indicating if the node uses the original sub-node interface.

Returns

TypeDescription
boolAlways returns True in this implementation.

bound_inputs()

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

Returns the set of input names that are bound to specific values and should not be mapped over.

Returns

TypeDescription
Set[str]An empty set of strings as bound inputs are currently not supported.