diff --git a/agent/worker/task_app.py b/agent/worker/task_app.py index 91eb5b2..11e78f4 100644 --- a/agent/worker/task_app.py +++ b/agent/worker/task_app.py @@ -563,6 +563,8 @@ 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, {}) @@ -600,6 +602,8 @@ 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") self.logger.info("Requirements are installed") def main_step(self): @@ -749,6 +753,12 @@ def _process_line(log_line): for log_line_arr in self._logs_output: for log_part in log_line_arr.decode("utf-8").splitlines(): logs_found = True + if self._pip_fail_message in log_part: + self._pip_fail = True + continue + if self._pip_success_message in log_part: + self._pip_fail = False + continue _process_line(log_part) if not logs_found: