From d906619befcc4ca49351f15d1599f83e7ed90606 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" <1330696+mr-c@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:45:56 +0100 Subject: [PATCH] more resiliancy (#4395) --- src/toil/fileStores/nonCachingFileStore.py | 6 +++++- src/toil/statsAndLogging.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/toil/fileStores/nonCachingFileStore.py b/src/toil/fileStores/nonCachingFileStore.py index 5d41725441..65fcc3f663 100644 --- a/src/toil/fileStores/nonCachingFileStore.py +++ b/src/toil/fileStores/nonCachingFileStore.py @@ -126,7 +126,11 @@ def open(self, job: Job) -> Generator[None, None, None]: os.chdir(startingDir) # Finally delete the job from the worker self.check_for_state_corruption() - os.remove(self.jobStateFile) + try: + os.remove(self.jobStateFile) + except FileNotFoundError: + logger.exception('Job state file %s has gone missing unexpectedly; some cleanup for failed jobs may be getting skipped!', self.jobStateFile) + pass def writeGlobalFile(self, localFileName: str, cleanup: bool=False) -> FileID: absLocalFileName = self._resolveAbsoluteLocalPath(localFileName) diff --git a/src/toil/statsAndLogging.py b/src/toil/statsAndLogging.py index 53fcaee37a..ec019a43be 100644 --- a/src/toil/statsAndLogging.py +++ b/src/toil/statsAndLogging.py @@ -148,6 +148,8 @@ def callback(fileHandle: Union[IO[bytes], IO[str]]) -> None: if not isinstance(statsStr, str): statsStr = statsStr.decode() stats = json.loads(statsStr, object_hook=Expando) + if not stats: + return try: logs = stats.workers.logsToMaster except AttributeError: