Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .lightning/workflows/fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ run: |

echo "Testing: fabric standalone"
export PL_RUN_STANDALONE_TESTS=1
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/run_standalone_tests.sh
python -m wget https://github.com/deependujha/utilities/blob/feat/specify-standalone-port/scripts/run_standalone_tests.sh
bash ./run_standalone_tests.sh "tests_fabric"
export PL_RUN_STANDALONE_TESTS=0

Expand Down
2 changes: 1 addition & 1 deletion .lightning/workflows/pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ run: |
echo "Testing: fabric standalone"
export PL_USE_MOCKED_MNIST=1
export PL_RUN_STANDALONE_TESTS=1
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/run_standalone_tests.sh
python -m wget https://raw.githubusercontent.com/deependujha/utilities/refs/heads/feat/specify-standalone-port/scripts/run_standalone_tests.sh
bash ./run_standalone_tests.sh "tests_pytorch"
export PL_RUN_STANDALONE_TESTS=0

Expand Down
8 changes: 6 additions & 2 deletions src/lightning/fabric/plugins/environments/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,14 @@ def find_free_network_port() -> int:
"""
# If an external launcher already specified a MASTER_PORT (for example, torch.distributed.spawn or
# multiprocessing helpers), reserve it through the port manager so no other test reuses the same number.
_port = None
if "STANDALONE_PORT" in os.environ:
_port = os.environ["STANDALONE_PORT"]
if "MASTER_PORT" in os.environ:
master_port_str = os.environ["MASTER_PORT"]
_port = os.environ["MASTER_PORT"]
if _port is not None:
try:
existing_port = int(master_port_str)
existing_port = int(_port)
except ValueError:
pass
else:
Expand Down
Loading