mmcv
mmcv copied to clipboard
[Enhancement]Improve the logic for find free port in distributed training
Motivation
deal with some cases mentioned in issue #1865
Modification
1.add print_log
to log the updated free port to inform users since it is different from the expected port
2.when the port set by users is not free,find a free port and log the free port to inform users.
Checklist
Before PR:
- [x] I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
- [x] Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
- [x] Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
- [x] New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
- [x] The documentation has been modified accordingly, including docstring or example tutorials.
After PR:
- [x] If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects, like MMDet or MMCls.
- [x] CLA has been signed and all committers have signed the CLA in this PR.
pytest tests/test_runner/test_dist_utils.py::test_init_dist -s -v
FAILED tests/test_runner/test_dist_utils.py::test_init_dist - socket.gaierror: [Errno -2] Name or service not known
pytest tests/test_runner/test_dist_utils.py::test_init_dist -s -v
FAILED tests/test_runner/test_dist_utils.py::test_init_dist - socket.gaierror: [Errno -2] Name or service not known
This is probably caused by /etc/hosts not properly set up, see https://stackoverflow.com/questions/38254394/name-or-service-not-known for more details.