This class represents a node that executes a target Flyte entity, such as a launch plan or task, over a collection of inputs in parallel. It manages execution parameters including concurrency limits, minimum success counts, and success ratios to control how the array of sub-tasks is processed. The class automatically transforms the target's interface to handle list-based inputs and outputs, supporting both local execution and remote workflow compilation.
Attributes
| Attribute | Type | Description |
|---|
| target | Union[LaunchPlan, ReferenceTask, "FlyteLaunchPlan"] | The target Flyte entity to map over |
| id | string | Unique identifier for the node, derived from the target entity's name. |
| metadata | Optional[_workflow_model.NodeMetadata] | The metadata for the underlying node |
| name | string | The name of the target entity, used for node identification within the workflow. |
| python_interface | flyte_interface.Interface | The transformed interface representing the list-based inputs and outputs for local execution. |
| interface | _interface_models.TypedInterface | The transformed typed interface used for remote execution and serialization. |
| bindings | List[_literal_models.Binding] = [] | A list of input bindings that define how data is passed to the mapped task. |
| upstream_nodes | List[Node] = [] | A list of nodes that must complete before this node can execute, currently returning an empty list. |
| flyte_entity | Any | The underlying Flyte entity (task or launch plan) being executed by this node. |
| data_mode | _core_workflow.ArrayNode.DataMode | Determines how input data is partitioned, such as single input file or individual files. |
| min_success_ratio | Optional[float] = 1.0 | The minimum ratio of successful executions. |
| min_successes | Optional[int] = 0 | The minimum number of successful executions. If set, this takes precedence over min_success_ratio |
| concurrency | Optional[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.ExecutionMode | Defines the state management strategy for the array node, such as full or minimal state. |
| is_original_sub_node_interface | boolean = true | A boolean flag indicating if the node uses the original sub-node interface. |
| bound_inputs | Set[str] = set() | A set of input names that are bound to specific values and not 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
| Name | Type | Description |
|---|
| target | Union[LaunchPlan, ReferenceTask, FlyteLaunchPlan] | The target Flyte entity to map over. |
| bindings | Optional[List[_literal_models.Binding]] = None | A list of input bindings for the node. |
| concurrency | Optional[int] = None | Limits the number of mapped tasks running in parallel. 0 means unbounded; None inherits from the workflow. |
| min_successes | Optional[int] = None | The minimum number of successful executions required. |
| min_success_ratio | Optional[float] = None | The minimum ratio of successful executions required (defaults to 1.0 if min_successes is not set). |
| metadata | Optional[_workflow_model.NodeMetadata] = None | Metadata for the underlying node. |
Methods
def construct_node_metadata(self) -> _workflow_model.NodeMetadata: ...
Constructs the metadata for the underlying node, defaulting to the target entity name if no specific metadata is provided.
Returns
| Type | Description |
|---|
_workflow_model.NodeMetadata | The 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
| Type | Description |
|---|
str | The string identifier of the target entity. |
python_interface()
@property
def python_interface(self) -> flyte_interface.Interface: ...
Provides the Python-native interface definition for the array node, typically transformed to represent list inputs/outputs.
Returns
| Type | Description |
|---|
flyte_interface.Interface | The interface object defining the Python types for inputs and outputs. |
interface()
@property
def interface(self) -> _interface_models.TypedInterface: ...
Retrieves the typed interface models for the node, used primarily during serialization.
Returns
| Type | Description |
|---|
_interface_models.TypedInterface | The low-level typed interface model for the remote entity. |
bindings()
@property
def bindings(self) -> List[_literal_models.Binding]: ...
Returns the list of literal bindings that map workflow inputs to the node's parameters.
Returns
| Type | Description |
|---|
List[_literal_models.Binding] | A list of bindings representing the data flow into the node. |
upstream_nodes()
@property
def upstream_nodes(self) -> List[Node]: ...
Identifies the nodes that must complete execution before this node can start.
Returns
| Type | Description |
|---|
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 maps over.
Returns
| Type | Description |
|---|
Any | The target entity instance. |
data_mode()
@property
def data_mode(self) -> _core_workflow.ArrayNode.DataMode: ...
Indicates how data is partitioned and passed to the sub-tasks (e.g., single input file vs individual files).
Returns
| Type | Description |
|---|
_core_workflow.ArrayNode.DataMode | The data mode enum value determining input handling. |
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.
Parameters
| Name | Type | Description |
|---|
| ctx | FlyteContext | The execution context providing access to configuration and state. |
| kwargs | Any | The keyword arguments representing the input lists to be mapped over. |
Returns
| Type | Description |
|---|
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.
Returns
| Type | Description |
|---|
Any | The local task execution mode constant. |
min_success_ratio()
@property
def min_success_ratio(self) -> Optional[float]: ...
Fetches the minimum ratio of successful sub-task executions required for the ArrayNode to be considered successful.
Returns
| Type | Description |
|---|
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]: ...
Fetches the absolute minimum number of successful sub-task executions required.
Returns
| Type | Description |
|---|
Optional[int] | The integer count of required successes. |
concurrency()
@property
def concurrency(self) -> Optional[int]: ...
Fetches the limit on the number of sub-tasks that can run in parallel.
Returns
| Type | Description |
|---|
Optional[int] | The maximum batch size for parallel execution, or None for workflow default. |
execution_mode()
@property
def execution_mode(self) -> _core_workflow.ArrayNode.ExecutionMode: ...
Indicates the execution strategy, such as FULL_STATE or MINIMAL_STATE, based on the target entity type.
Returns
| Type | Description |
|---|
_core_workflow.ArrayNode.ExecutionMode | The execution mode enum value. |
is_original_sub_node_interface()
@property
def is_original_sub_node_interface(self) -> bool: ...
Indicates if the node uses the original sub-node interface definition.
Returns
| Type | Description |
|---|
bool | Always returns True for ArrayNode instances. |
@property
def bound_inputs(self) -> Set[str]: ...
Returns the set of input names that are bound to specific values rather than mapped over.
Returns
| Type | Description |
|---|
Set[str] | An empty set as bound inputs are currently not supported. |