Skip to content

Commit

Permalink
idl update
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Dittamo <[email protected]>
  • Loading branch information
pvditt committed Nov 19, 2024
1 parent 7653c09 commit e98bc6e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions flytekit/core/array_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ def execution_mode(self) -> _core_workflow.ArrayNode.ExecutionMode:
return self._execution_mode

@property
def is_original_sub_node_interface(self) -> bool:
return True
def sub_node_interface_status(self) -> _core_workflow.ArrayNode.SubNodeInterfaceStatus:
return _core_workflow.ArrayNode.SUB_NODE_INTERFACE_ORIGINAL

def __call__(self, *args, **kwargs):
if not self._bindings:
Expand Down
4 changes: 2 additions & 2 deletions flytekit/core/array_node_map_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def execution_mode(self) -> _core_workflow.ArrayNode.ExecutionMode:
return self._execution_mode

@property
def is_original_sub_node_interface(self) -> bool:
return False
def sub_node_interface_status(self) -> _core_workflow.ArrayNode.SubNodeInterfaceStatus:
return _core_workflow.ArrayNode.SUB_NODE_INTERFACE_LIST

def get_extended_resources(self, settings: SerializationSettings) -> Optional[tasks_pb2.ExtendedResources]:
return self.python_function_task.get_extended_resources(settings)
Expand Down
6 changes: 3 additions & 3 deletions flytekit/models/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def __init__(
min_successes=None,
min_success_ratio=None,
execution_mode=None,
is_original_sub_node_interface=False,
sub_node_interface_status=False,
) -> None:
"""
TODO: docstring
Expand All @@ -399,7 +399,7 @@ def __init__(
self._min_successes = min_successes
self._min_success_ratio = min_success_ratio
self._execution_mode = execution_mode
self._is_original_sub_node_interface = is_original_sub_node_interface
self._sub_node_interface_status = sub_node_interface_status

@property
def node(self) -> "Node":
Expand All @@ -412,7 +412,7 @@ def to_flyte_idl(self) -> _core_workflow.ArrayNode:
min_successes=self._min_successes,
min_success_ratio=self._min_success_ratio,
execution_mode=self._execution_mode,
is_original_sub_node_interface=self._is_original_sub_node_interface,
sub_node_interface_status=self._sub_node_interface_status,
)

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions flytekit/tools/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def get_serializable_array_node(
min_successes=array_node.min_successes,
min_success_ratio=array_node.min_success_ratio,
execution_mode=array_node.execution_mode,
is_original_sub_node_interface=array_node.is_original_sub_node_interface,
sub_node_interface_status=array_node.sub_node_interface_status,
)


Expand Down Expand Up @@ -630,7 +630,7 @@ def get_serializable_array_node_map_task(
min_successes=entity.min_successes,
min_success_ratio=entity.min_success_ratio,
execution_mode=entity.execution_mode,
is_original_sub_node_interface=entity.is_original_sub_node_interface,
sub_node_interface_status=entity.sub_node_interface_status,
)


Expand Down
5 changes: 5 additions & 0 deletions tests/flytekit/unit/core/test_array_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections import OrderedDict

import pytest
from flyteidl.core import workflow_pb2 as _core_workflow

from flytekit import LaunchPlan, task, workflow
from flytekit.core.context_manager import FlyteContextManager
Expand Down Expand Up @@ -95,6 +96,10 @@ def test_lp_serialization(target, overrides_metadata, serialization_settings):
assert len(wf_spec.template.nodes) == 1

parent_node = wf_spec.template.nodes[0]
assert parent_node.array_node._min_success_ratio == 0.9
assert parent_node.array_node._parallelism == 10
assert parent_node.array_node._sub_node_interface_status == _core_workflow.ArrayNode.SUB_NODE_INTERFACE_ORIGINAL
assert parent_node.array_node._execution_mode == _core_workflow.ArrayNode.FULL_STATE
assert parent_node.inputs[0].var == "a"
assert len(parent_node.inputs[0].binding.collection.bindings) == 3
for binding in parent_node.inputs[0].binding.collection.bindings:
Expand Down
2 changes: 1 addition & 1 deletion tests/flytekit/unit/core/test_array_node_map_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def wf1(x: typing.List[int]):
assert array_node.metadata.interruptible
assert array_node.array_node._min_success_ratio == 0.9
assert array_node.array_node._parallelism == 10
assert not array_node.array_node._is_original_sub_node_interface
assert array_node.array_node._sub_node_interface_status == _core_workflow.ArrayNode.SUB_NODE_INTERFACE_LIST
assert array_node.array_node._execution_mode == _core_workflow.ArrayNode.MINIMAL_STATE
task_spec = od[arraynode_maptask]
assert task_spec.template.metadata.retries.retries == 2
Expand Down

0 comments on commit e98bc6e

Please sign in to comment.