From 7082c69a75f9b6c0b1cc8b78c858cfc51bff89ce Mon Sep 17 00:00:00 2001 From: Tony Bartsits Date: Wed, 21 Feb 2024 12:52:38 +0000 Subject: [PATCH] pip install check bugfix --- agent/worker/task_app.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/agent/worker/task_app.py b/agent/worker/task_app.py index fb6b01c..474e07f 100644 --- a/agent/worker/task_app.py +++ b/agent/worker/task_app.py @@ -572,8 +572,6 @@ def _exec_command(self, command, add_envs=None, container_id=None): }, ) self._logs_output = self._docker_api.api.exec_start(self._exec_id, stream=True) - exec_info = self._docker_api.api.exec_inspect(self._exec_id) - self._exit_code = exec_info["ExitCode"] def exec_command(self, add_envs=None, command=None): add_envs = sly.take_with_default(add_envs, {}) @@ -611,8 +609,12 @@ def install_pip_requirements(self, container_id=None): self.logger.info(f"PIP command: {command}") self._exec_command(command, add_envs=self.main_step_envs(), container_id=container_id) self.process_logs() - if self._exit_code != 0: - raise RuntimeError("Pip install failed") + + pip_install_exec_info = self._docker_api.api.exec_inspect(self._exec_id) + + if pip_install_exec_info['ExitCode'] != 0: + raise RuntimeError("Pip install failed") + self.logger.info("Requirements are installed") def main_step(self):