<#1196 fix(ray): merge requests/limits into head/w...
# flyte-github
a
#1196 fix(ray): merge requests/limits into head/worker pod_template instead of replacing it Pull request opened by pingsutw Summary When a Ray `HeadNodeConfig`/`WorkerNodeConfig` set both `requests`/`limits` and a custom
pod_template
,
custom_config
built a fresh pod spec from the resources alone and dropped the user's
PodTemplate
during serialization. This silently discarded custom container fields (e.g. `args`/`command`/`env` used for BYOK auth entrypoints) and the cpu/memory declared on the template — only
nvidia.com/gpu
survived.
custom_config
now merges the resource requirements into the primary container of the user's
pod_template
instead of replacing it: • locates the container by the Ray container name (`ray-head`/`ray-worker`), falling back to the sole container, then appends one if absent; • overlays the `requests`/`limits`-derived resource keys onto the container's existing resources (structured resources win on key collisions), preserving `args`/`command`/`env`/volumes and everything else; •
extended_resources
(the GPU accelerator node selector) is unchanged. Before if c.requests or c.limits: worker_pod_template = PodTemplate(pod_spec=pod_spec_from_resources(...)) # fresh spec, template dropped else: worker_pod_template = c.pod_template For a config that sets
requests=Resources(gpu="A10G:1")
plus a
pod_template
with
args=[wut_cmd]
and cpu/memory, the serialized worker container ended up with only
nvidia.com/gpu: 1
and
args=None
. After The worker container keeps the
wut
auth args and `15000m`/`45Gi` cpu/memory and
nvidia.com/gpu: 1
, with
extended_resources
still reporting
nvidia-a10g
. Test plan • Added regression tests: head merge, worker merge, request precedence over template resources, and no-resource pass-through. •
pytest plugins/ray/tests/test_task.py
→ 7 passed. •
ruff check
/
ruff format --check
clean. Reported in Slack. flyteorg/flyte-sdk