Some cleanup
This commit is contained in:
@@ -39,13 +39,13 @@ class Hub(dict):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.update({matlab.port: matlab for matlab in self.find_running()})
|
self.update({matlab.port: matlab for matlab in self.find_running()})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def find_running(self):
|
def find_running():
|
||||||
p = subprocess.run('screen -list', shell=True, capture_output=True)
|
p = subprocess.run('screen -list', shell=True, capture_output=True)
|
||||||
return [Matlab(port, group) for group, port in re.findall(r'\.matlab_([^_]+)_(\d+)', str(p.stdout))]
|
return [Matlab(port, group) for group, port in re.findall(r'\.matlab_([^_]+)_(\d+)', str(p.stdout))]
|
||||||
|
|
||||||
def new(self, group=None):
|
def new(self, group=None):
|
||||||
group = re.escape(re.sub(r'[^\w]|_', '', group))
|
group = re.escape(re.sub(r'\W|_', '', group))
|
||||||
ports = list(range(*config['port_range']))
|
ports = list(range(*config['port_range']))
|
||||||
random.shuffle(ports)
|
random.shuffle(ports)
|
||||||
for port in ports:
|
for port in ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user