diff --git a/src/swerex/deployment/docker.py b/src/swerex/deployment/docker.py index 1bd72fa6..5e6e61dc 100644 --- a/src/swerex/deployment/docker.py +++ b/src/swerex/deployment/docker.py @@ -117,8 +117,8 @@ async def _wait_until_alive(self, timeout: float = 10.0): def _get_token(self) -> str: return str(uuid.uuid4()) - def _get_swerex_start_cmd(self, token: str) -> list[str]: - rex_args = f"--auth-token {token}" + def _get_swerex_start_cmd(self, token: str, port: int) -> list[str]: + rex_args = f"--auth-token {token} --port {port}" pipx_install = "python3 -m pip install pipx && python3 -m pipx ensurepath" if self._config.python_standalone_dir: cmd = f"{self._config.python_standalone_dir}/python3.11/bin/{REMOTE_EXECUTABLE_NAME} {rex_args}" @@ -253,13 +253,13 @@ async def start(self): "run", *rm_arg, "-p", - f"{self._config.port}:8000", + f"{self._config.port}:{self._config.port}", *platform_arg, *self._config.docker_args, "--name", self._container_name, image_id, - *self._get_swerex_start_cmd(token), + *self._get_swerex_start_cmd(token, self._config.port), ] cmd_str = shlex.join(cmds) self.logger.info( diff --git a/src/swerex/runtime/local.py b/src/swerex/runtime/local.py index fa46866f..522ce374 100644 --- a/src/swerex/runtime/local.py +++ b/src/swerex/runtime/local.py @@ -55,12 +55,12 @@ __all__ = ["LocalRuntime", "BashSession"] -def _split_bash_command(inpt: str) -> list[str]: +def _split_bash_command(input: str) -> list[str]: r"""Split a bash command with linebreaks, escaped newlines, and heredocs into a list of individual commands. Args: - inpt: The input string to split into commands. + input: The input string to split into commands. Returns: A list of commands as strings. @@ -70,11 +70,11 @@ def _split_bash_command(inpt: str) -> list[str]: "cmd1\\\n asdf" is one command (because the linebreak is escaped) "cmd1< tuple[int, int]: @@ -88,7 +88,7 @@ def find_range(cmd: bashlex.ast.node) -> tuple[int, int]: for cmd in parsed: start, end = find_range(cmd) - cmd_strings.append(inpt[start:end]) + cmd_strings.append(input[start:end]) return cmd_strings