Skip to content

Commit

Permalink
Enh: Avoid "startint at port None" messages (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret authored Nov 12, 2024
1 parent 608270d commit 4f9c130
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/swerex/deployment/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def _get_swerex_start_cmd(self, token: str) -> list[str]:

async def start(self):
"""Starts the runtime."""
port = self._port or find_free_port()
if self._port is None:
self._port = find_free_port()
assert self._container_name is None
self._container_name = self._get_container_name()
token = self._get_token()
Expand All @@ -109,7 +110,7 @@ async def start(self):
"run",
"--rm",
"-p",
f"{port}:8000",
f"{self._port}:8000",
*self._docker_args,
"--name",
self._container_name,
Expand All @@ -124,7 +125,7 @@ async def start(self):
# shell=True required for && etc.
self._container_process = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self.logger.info(f"Starting runtime at {self._port}")
self._runtime = RemoteRuntime(port=port, timeout=self._runtime_timeout, auth_token=token)
self._runtime = RemoteRuntime(port=self._port, timeout=self._runtime_timeout, auth_token=token)
t0 = time.time()
await self._wait_until_alive(timeout=self._startup_timeout)
self.logger.info(f"Runtime started in {time.time() - t0:.2f}s")
Expand Down

0 comments on commit 4f9c130

Please sign in to comment.