From e5b064cf01fc9a12d55c57b2b2e38a62153d555c Mon Sep 17 00:00:00 2001 From: dbeltran Date: Wed, 4 Dec 2024 17:16:36 +0100 Subject: [PATCH 1/4] try to fix test, and better cleaning of Filedescriptors ( 4.1.11 issue) --- autosubmit/autosubmit.py | 5 +++-- autosubmit/platforms/paramiko_platform.py | 1 + autosubmit/platforms/platform.py | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/autosubmit/autosubmit.py b/autosubmit/autosubmit.py index 6f84065b7..dcd94d11b 100644 --- a/autosubmit/autosubmit.py +++ b/autosubmit/autosubmit.py @@ -2384,6 +2384,7 @@ class Autosubmit: if p.log_recovery_process: p.cleanup_event.set() # Send cleanup event p.log_recovery_process.join() + Log.info(f"Log recovery process for {p.name} has finished") for job in job_list.get_completed_failed_without_logs(): # update the info gathered from the childs job_list.update_log_status(job, as_conf) job_list.save() @@ -2401,8 +2402,8 @@ class Autosubmit: Autosubmit.database_fix(expid) except Exception as e: pass - for platform in platforms_to_test: - platform.closeConnection() + for p in platforms_to_test: + p.closeConnection() if len(job_list.get_failed()) > 0: Log.info("Some jobs have failed and reached maximum retrials") else: diff --git a/autosubmit/platforms/paramiko_platform.py b/autosubmit/platforms/paramiko_platform.py index 205a869eb..eba3f9f95 100644 --- a/autosubmit/platforms/paramiko_platform.py +++ b/autosubmit/platforms/paramiko_platform.py @@ -95,6 +95,7 @@ class ParamikoPlatform(Platform): return self._wrapper def reset(self): + self.closeConnection() self.connected = False self._ssh = None self._ssh_config = None diff --git a/autosubmit/platforms/platform.py b/autosubmit/platforms/platform.py index 326189c7c..52cc6e442 100644 --- a/autosubmit/platforms/platform.py +++ b/autosubmit/platforms/platform.py @@ -1,6 +1,7 @@ import atexit import multiprocessing import queue # only for the exception +from os import _exit import setproctitle import locale import os @@ -992,4 +993,6 @@ class Platform(object): if self.cleanup_event.is_set(): # Check if the main process is waiting for this child to end. self.recover_job_log(identifier, jobs_pending_to_process) break + self.closeConnection() Log.info(f"{identifier} Exiting.") + _exit(0) # Exit userspace, recommended for processes. -- GitLab From 0adf9c4e512cd7203ff5f2e8911872920fe246ee Mon Sep 17 00:00:00 2001 From: dbeltran Date: Wed, 4 Dec 2024 17:20:09 +0100 Subject: [PATCH 2/4] added more context to the comment --- autosubmit/platforms/platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autosubmit/platforms/platform.py b/autosubmit/platforms/platform.py index 52cc6e442..288e9b3c7 100644 --- a/autosubmit/platforms/platform.py +++ b/autosubmit/platforms/platform.py @@ -995,4 +995,4 @@ class Platform(object): break self.closeConnection() Log.info(f"{identifier} Exiting.") - _exit(0) # Exit userspace, recommended for processes. + _exit(0) # Exit userspace after manually closing ssh sockets, recommended for processes, the queue() and shared signals should be in charge of the main process. -- GitLab From 51f215f18d09a2d9bcba33c21c3b8c3dc4b8f0b1 Mon Sep 17 00:00:00 2001 From: dbeltran Date: Wed, 4 Dec 2024 17:32:16 +0100 Subject: [PATCH 3/4] added closeConnection also atexit --- autosubmit/platforms/platform.py | 1 + 1 file changed, 1 insertion(+) diff --git a/autosubmit/platforms/platform.py b/autosubmit/platforms/platform.py index 288e9b3c7..63c99610e 100644 --- a/autosubmit/platforms/platform.py +++ b/autosubmit/platforms/platform.py @@ -883,6 +883,7 @@ class Platform(object): Log.result(f"Process {self.log_recovery_process.name} started with pid {self.log_recovery_process.pid}") # Cleanup will be automatically prompt on control + c or a normal exit atexit.register(self.send_cleanup_signal) + atexit.register(self.closeConnection) def send_cleanup_signal(self) -> None: """ -- GitLab From 8a8fd2d20e47ff3d1db477746d5e4ed7a44b9d76 Mon Sep 17 00:00:00 2001 From: dbeltran Date: Tue, 10 Dec 2024 11:36:51 +0100 Subject: [PATCH 4/4] changed the comment text --- autosubmit/platforms/platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autosubmit/platforms/platform.py b/autosubmit/platforms/platform.py index 63c99610e..bbc609e7a 100644 --- a/autosubmit/platforms/platform.py +++ b/autosubmit/platforms/platform.py @@ -996,4 +996,4 @@ class Platform(object): break self.closeConnection() Log.info(f"{identifier} Exiting.") - _exit(0) # Exit userspace after manually closing ssh sockets, recommended for processes, the queue() and shared signals should be in charge of the main process. + _exit(0) # Exit userspace after manually closing ssh sockets, recommended for child processes, the queue() and shared signals should be in charge of the main process. -- GitLab