<#1092 feat: add clustered task pod entrypoint mod...
# flyte-github
a
#1092 feat: add clustered task pod entrypoint module Pull request opened by AdilFayyaz Motivation JobSet-based distributed training pods need a bootstrapper that runs before torchrun — deriving master address from Kubernetes-injected env vars, waiting for DNS, and handing off to torchrun with the correct node rank and rendezvous ID. This is essentially a Python module that ships in the SDK alongside a0. Summary • Adds
flyte/distributed/_entrypoint.py
— runs as PID 1 via
python -m flyte.distributed._entrypoint
, derives
MASTER_ADDR
from
JOBSET_NAME + POD_NAMESPACE
, busy-waits for DNS (5-min timeout), then
os.execvp("torchrun", [...])
•
RDZV_ID
is rotated on each JobSet restart (
JOBSET_NAME-JOBSET_RESTART_ATTEMPT
) so torchrun does a fresh rendezvous rather than reconnecting to a stale one • Adds
flyte/distributed/__init__.py
as a package stub — public API (
ClusteredTaskEnvironment
etc.) added in PR 5. This is PR 2 of the plan. • 7 unit tests covering happy path, DNS timeout, missing env vars, RDZV_ID rotation, NODE_RANK mapping, and MASTER_PORT default (29500) Test Plan •
cd flyte-sdk && .venv/bin/pytest tests/flyte/distributed/test_entrypoint.py -v
— all 7 tests pass •
python -c "import flyte.distributed._entrypoint"
— module is importable with no side effects flyteorg/flyte-sdk