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 handles interface transformations to map scalar inputs into list-based interfaces for parallel or batch processing.
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 for remote entities, representing list-based inputs and outputs. |
| bindings | List[_literal_models.Binding] = [] | A list of input bindings that map workflow data to the node's inputs. |
| upstream_nodes | List[Node] = [] | A list of nodes that must complete before this node can start; always returns an empty list for ArrayNode. |
| flyte_entity | Any | The underlying Flyte entity (task or launch plan) that this node wraps. |
| data_mode | _core_workflow.ArrayNode.DataMode | Indicates how input data is partitioned, such as using a 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 | Determines the state management strategy, such as FULL_STATE or MINIMAL_STATE, based on the target type. |
| is_original_sub_node_interface | boolean = true | A boolean flag indicating if the node uses the original sub-node interface definition. |
| bound_inputs | Set[string] = set() | The set of input names that are bound to specific values; currently returns an empty set. |
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 number of successful executions required. Takes precedence over min_success_ratio. |
| 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 and returns the metadata for the 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 underlying Flyte 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 handle list inputs and outputs.
Returns
| Type | Description |
|---|
flyte_interface.Interface | The interface object representing the Python signature of the mapped task. |
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
| Type | Description |
|---|
_interface_models.TypedInterface | The typed interface model used for serialization and remote execution. |
bindings()
@property
def bindings(self) -> List[_literal_models.Binding]: ...
Returns the list of input bindings that map workflow variables to the node's inputs.
Returns
| Type | Description |
|---|
List[_literal_models.Binding] | A list of binding models defining how inputs are connected to this node. |
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
| Type | Description |
|---|
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
| Type | Description |
|---|
Any | The target Flyte entity object. |
data_mode()
@property
def data_mode(self) -> _core_workflow.ArrayNode.DataMode: ...
Indicates how data is transferred to the sub-nodes, such as via single or individual input files.
Returns
| Type | Description |
|---|
_core_workflow.ArrayNode.DataMode | The data mode enum value determining input file structure. |
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.
Parameters
| Name | Type | Description |
|---|
| ctx | FlyteContext | The execution context providing access to configuration and state. |
| kwargs | Any | The input arguments for the node, where mapped inputs are expected to be lists. |
Returns
| Type | Description |
|---|
Union[Tuple[Promise], Promise, VoidPromise] | A promise containing a collection of literals representing the aggregated results of the mapped executions. |
local_execution_mode()
def local_execution_mode(self): ...
Returns the execution mode for local runs, identifying this as a local task execution.
Returns
| Type | Description |
|---|
ExecutionState.Mode | The local task execution mode identifier. |
min_success_ratio()
@property
def min_success_ratio(self) -> Optional[float]: ...
Returns the minimum ratio of successful sub-node executions required for the ArrayNode 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]: ...
Returns 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]: ...
Returns the maximum number of sub-nodes that can execute in parallel.
Returns
| Type | Description |
|---|
Optional[int] | The concurrency limit, or None if inheriting from the workflow. |
execution_mode()
@property
def execution_mode(self) -> _core_workflow.ArrayNode.ExecutionMode: ...
Returns the execution mode (e.g., FULL_STATE or MINIMAL_STATE) based on the type of target entity.
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 whether the node uses the original sub-node interface; always returns True.
Returns
| Type | Description |
|---|
bool | Boolean flag indicating interface status. |
@property
def bound_inputs(self) -> Set[str]: ...
Returns the set of inputs that are bound to specific values; currently returns an empty set.
Returns
| Type | Description |
|---|
Set[str] | A set of input variable names that are bound. |