<#1350 feat: populate TaskTemplate.reuse_policy fo...
# flyte-github
a
#1350 feat: populate TaskTemplate.reuse_policy for reusable tasks Pull request opened by pingsutw Overview Populate the structured
TaskTemplate.reuse_policy
field from
ReusePolicy
during serialization, so a task's environment-reuse configuration is carried as a first-class field instead of being encoded inside the untyped
custom
Struct. • ray: the reuse policy moves to `reuse_policy`;
custom_config
no longer writes a
reusePolicy
key into the RayJob spec (the "exactly 1 replica" validation stays). Cluster-backed plugins read the policy from
reuse_policy
. • actor: also populates
reuse_policy
, while keeping the existing
actor
spec in
custom
for backward compatibility with readers that predate the field. A shared
reuse_policy_to_pb()
helper converts the
ReusePolicy
dataclass into the proto message;
reuse.py
gains
from __future__ import annotations
so the module still imports against older
flyteidl2
. Dependency
TaskTemplate.reuse_policy
landed upstream (flyteorg/flyte#7731) and shipped in flyteidl2 2.0.37; this PR bumps the pin (and `rs_controller`'s) to 2.0.37, so serialization works against the released package — no local/unpublished build needed. Test plan • Verified end-to-end that serializing a reusable actor task sets
reuse_policy
(min/max replicas, concurrency, idle/scaledown TTLs) and keeps the
actor
spec in
custom
. • Updated `plugins/ray/tests/test_task.py`:
test_custom_config_omits_reuse_policy
asserts
custom
no longer carries `reusePolicy`; the multi-replica rejection test is unchanged. flyteorg/flyte-sdk