Skip to content

Commit

Permalink
refactor(Dashboard): rename Dashboard.is_port_available to `Dashboa…
Browse files Browse the repository at this point in the history
…rd.is_port_at_ip_available`
  • Loading branch information
BjoernLudwigPTB committed Jul 30, 2021
1 parent 0b5d280 commit 25a9700
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions agentMET4FOF/dashboard/Dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, dashboard_modules=[], dashboard_layouts=[],
"""
super(AgentDashboard, self).__init__()
if self.is_port_available(ip_addr, port):
if self.is_port_at_ip_available(ip_addr, port):
if dashboard_modules is not None and dashboard_modules is not False:

#initialise the dashboard layout and its control here
Expand Down Expand Up @@ -166,8 +166,8 @@ def render_content(tab):
return [dashboard_layout.get_layout()]
return app

def is_port_available(self, ip_addr, _port):
"""Check if desired ip and port are available."""
def is_port_at_ip_available(self, ip_addr: str, _port: int) -> bool:
"""Check if desired port at ip is available"""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
# Set timeout to wait for response on ip:port.
sock.settimeout(1)
Expand Down

0 comments on commit 25a9700

Please sign in to comment.