Skip to content

Commit

Permalink
get correct application exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaiPetukhov committed Dec 5, 2024
1 parent 28201e1 commit 42a2fcc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions agent/worker/task_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def main_step(self):

logs_cnt = self.process_logs()
if logs_cnt == 0:
self.logger.warn("No logs received from the container")# check if bug occurred
self.logger.warn("No logs received from the container") # check if bug occurred

self.drop_container_and_check_status()
except:
Expand Down Expand Up @@ -834,8 +834,7 @@ def _decode(bytes: bytes):
for log_part in _decode(log_line_arr).splitlines():
yield log_part


def process_logs(self, logs_arr = None):
def process_logs(self, logs_arr=None):
result_logs = logs_arr
logs_cnt = 0

Expand Down Expand Up @@ -865,7 +864,6 @@ def process_logs(self, logs_arr = None):

return logs_cnt


def _stop_wait_container(self):
if self.is_isolate():
return super()._stop_wait_container()
Expand All @@ -880,6 +878,11 @@ def exec_stop(self):
else:
return

def get_exit_status(self):
exec_info = self._docker_api.api.exec_inspect(self._exec_id)
exit_code = exec_info["ExitCode"]
return exit_code

def _drop_container(self):
if self.is_isolate():
super()._drop_container()
Expand All @@ -888,7 +891,7 @@ def _drop_container(self):

def drop_container_and_check_status(self):
self._container.reload()
status = self._container.attrs["State"]["ExitCode"]
status = self.get_exit_status()

if self.is_isolate():
self._drop_container()
Expand Down

0 comments on commit 42a2fcc

Please sign in to comment.