<#3428 Carry pod_template override through map_tas...
# flyte-github
a
#3428 Carry pod_template override through map_task serialization Pull request opened by 1fanwang Tracking issue Fixes flyteorg/flyte#7076 Why are the changes needed?
map_task(...).with_overrides(pod_template=PodTemplate(...))
silently drops the override at serialization. The override is accepted at workflow build time and stored on the
Node
(
node._pod_template
), but
get_serializable_array_node_map_task
in
flytekit/tools/translator.py
never reads that field — it builds
TaskNodeOverrides
with only
resources
,
extended_resources
, and
container_image
. The user thinks the override is applied, but the registered task spec has an empty
overrides {}
block. This is the same class of bug as #6463, which #3270 fixed for the regular-task path of
get_serializable_node
. The array-node path has the same gap in a different function. What changes were proposed in this pull request?
flytekit/tools/translator.py
— `get_serializable_array_node_map_task`: • Read
node._pod_template
, build the override pod spec via
_serialize_pod_spec
, and include
pod_template
in the emitted
TaskNodeOverrides
. • Use
entity.get_container(settings)
(not
_get_container
) so
prepare_target()
substitutes the map-task command (
pyflyte-map-execute
) into the container args before the pod spec is built.
ArrayNodeMapTask
extends
PythonTask
directly (not
PythonAutoContainerTask
), so
_get_container
isn't on it anyway. • For fast-serialization, prefix container args post-build (matching the existing pattern in
get_serializable_task
at
translator.py:170
) instead of swapping
command_fn
via
_fast_serialize_command_fn
. The latter wraps
task.get_default_command(settings)
, which on
ArrayNodeMapTask
returns the inherited
pyflyte-execute
— wrong shape for a map task. `tests/flytekit/unit/test_translator.py`: • New parametrized regression test
test_map_task_with_pod_template_override
covering both
fast_registration_enabled=True
and
False
. Mirrors the structure of the existing
test_task_with_pod_template_override
from #3270. How was this patch tested? • New parametrized test passes (both cases). • Full
tests/flytekit/unit/test_translator.py
(11 tests) passes. • Adjacent suites that exercise the same surfaces all pass with no regressions: •
tests/flytekit/unit/core/test_array_node_map_task.py
(46 tests) •
tests/flytekit/unit/core/test_map_task.py
(23 tests) •
tests/flytekit/unit/core/test_node_creation.py
(26 tests) Check all the applicable boxes • All new and existing tests passed. • All commits are signed-off. • I updated the documentation accordingly. (No user-facing behavior change beyond the bug fix; the documented behavior of
withoverrides(podtemplate=...)
for
maptask
is what this PR makes work.)
flyteorg/flytekit