From 8b6217733a7f6364e8e551738fbb6a2958b6febc Mon Sep 17 00:00:00 2001 From: William Falcon Date: Wed, 24 Jul 2019 15:11:50 -0400 Subject: [PATCH] added auto port find --- pytorch_lightning/models/trainer.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index e098ba9a..7875b5da 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -397,29 +397,6 @@ class Trainer(TrainerIO): # ----------------------------- # MODEL TRAINING # ----------------------------- - def __find_open_port(self, port=None): - - if port is None: - try: - port = os.environ['MASTER_PORT'] - except Exception as e: - port = 12801 - os.environ['MASTER_PORT'] = f'{port}' - - # check for pids - command = "lsof -i :%s | awk '{print $2}'" % port - pids = subprocess.check_output(command, shell=True) - pids = pids.strip() - pids = str(pids) - - # if no processes on this port, then we're good - if len(pids) == 0: - return - - # port wasn't open. Pick a new port and keep trying - port = int(port) + 1 - self.__find_open_port(str(port)) - def fit(self, model): # when using multi-node or DDP within a node start each module in a separate process