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
| 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 | NodeMetadata = null | The metadata for the underlying node |
| concurrency | integer = null | If specified, this limits the number of mapped tasks than can run in parallel to the given batch size. |
| min_successes | integer = 0 | The minimum number of successful executions. If set, this takes precedence over min_success_ratio |
| min_success_ratio | float = 1.0 | The minimum ratio of successful executions. |
| bindings | List[Binding] = [] | A list of input bindings that map workflow data to the node's interface. |
| python_interface | Interface | The transformed Python interface representing the collection-based inputs and outputs of the array node. |
| interface | TypedInterface | The transformed typed interface used for serialization and remote execution. |
| data_mode | DataMode | Determines how input data is partitioned, such as using a single input file or individual files per map instance. |
| execution_mode | ExecutionMode | Defines 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
| 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 workflow. |
| min_successes | Optional[int] = None | The minimum absolute number of successful executions required. |
| min_success_ratio | Optional[float] = None | The minimum ratio of successful executions required (default is 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: ...
Builds the metadata for the node, defaulting to the target entity's 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: ...
Fetches the identifier of the target Flyte entity.
Returns
| Type | Description |
|---|
str | The name of the target entity being mapped. |
python_interface()
@property
def python_interface(self) -> flyte_interface.Interface: ...
Retrieves the Python-native interface transformed for list-based inputs and outputs.
Returns
| Type | Description |
|---|
flyte_interface.Interface | The interface representing the collection-based inputs and outputs for the array node. |
interface()
@property
def interface(self) -> _interface_models.TypedInterface: ...
Retrieves the serialized typed interface for remote entities.
Returns
| Type | Description |
|---|
_interface_models.TypedInterface | The low-level typed interface used for serialization and remote execution. |
bindings()
@property
def bindings(self) -> List[_literal_models.Binding]: ...
Retrieves the list of input bindings associated with this node.
Returns
| Type | Description |
|---|
List[_literal_models.Binding] | A list of bindings that map workflow inputs to the node's parameters. |
upstream_nodes()
@property
def upstream_nodes(self) -> List[Node]: ...
Returns the list of nodes that this node depends on.
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 that is being executed in a mapped fashion.
Returns
| Type | Description |
|---|
Any | The target LaunchPlan or Task being mapped over. |
data_mode()
@property
def data_mode(self) -> _core_workflow.ArrayNode.DataMode: ...
Indicates how input data is partitioned and passed to the sub-nodes.
Returns
| Type | Description |
|---|
_core_workflow.ArrayNode.DataMode | The data mode specifying single or individual 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 collections and invoking the target entity for each element.
Parameters
| Name | Type | Description |
|---|
| ctx | FlyteContext | The current execution context providing access to local state and configuration. |
| kwargs | Any | The keyword arguments representing the input collections to map 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): ...
Returns the execution mode for local runs.
Returns
| Type | Description |
|---|
null | The 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 array node to be considered successful.
Returns
| Type | Description |
|---|
Optional[float] | A float between 0 and 1 representing the success threshold ratio. |
min_successes()
@property
def min_successes(self) -> Optional[int]: ...
Retrieves the absolute minimum number of successful sub-node executions required.
Returns
| Type | Description |
|---|
Optional[int] | The integer count of required successful executions. |
concurrency()
@property
def concurrency(self) -> Optional[int]: ...
Retrieves the maximum number of sub-nodes allowed to run in parallel.
Returns
| Type | Description |
|---|
Optional[int] | The concurrency limit, or None if it should inherit from the workflow. |
execution_mode()
@property
def execution_mode(self) -> _core_workflow.ArrayNode.ExecutionMode: ...
Indicates the execution strategy used by the array node (e.g., Full State vs Minimal State).
Returns
| Type | Description |
|---|
_core_workflow.ArrayNode.ExecutionMode | The execution mode determined by the type of the target entity. |
is_original_sub_node_interface()
@property
def is_original_sub_node_interface(self) -> bool: ...
Flag indicating 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 inputs that are bound to specific values rather than mapped over.
Returns
| Type | Description |
|---|
Set[str] | An empty set of input names. |