From bcc50d656687a37adb77d38ff047421c6766b2b0 Mon Sep 17 00:00:00 2001 From: Dusko Vesic Date: Wed, 4 Sep 2024 16:26:31 +0200 Subject: [PATCH 1/2] CTX-6554: Cleaning the list for uploading artifacts from files that were created and then deleted during execution. --- coretex/_task/worker/artifacts.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/coretex/_task/worker/artifacts.py b/coretex/_task/worker/artifacts.py index 3c61bcf3..0fcfa2d4 100644 --- a/coretex/_task/worker/artifacts.py +++ b/coretex/_task/worker/artifacts.py @@ -53,6 +53,13 @@ def on_created(self, event: FileSystemEvent) -> None: logging.getLogger("coretex").debug(f">> [Coretex] File created at path \"{filePath}\", adding to artifacts list") self.artifactPaths.append(filePath) + def on_deleted(self, event: FileSystemEvent) -> None: + filePath = Path(event.src_path) + + if filePath in self.artifactPaths: + logging.getLogger("coretex").debug(f">> [Coretex] Deleted file at path \"{filePath}\", removing from artifacts list") + self.artifactPaths.remove(filePath) + @contextmanager def track(taskRun: TaskRun) -> Iterator[FileEventHandler]: From eaeaba6f1f277bba6fd42f9d625d0de6adec7234 Mon Sep 17 00:00:00 2001 From: Dusko Vesic Date: Wed, 4 Sep 2024 16:55:17 +0200 Subject: [PATCH 2/2] CTX-6554: logger "coretex" replaced with "coretexpylib" --- coretex/_task/worker/artifacts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coretex/_task/worker/artifacts.py b/coretex/_task/worker/artifacts.py index 0fcfa2d4..aff384b4 100644 --- a/coretex/_task/worker/artifacts.py +++ b/coretex/_task/worker/artifacts.py @@ -50,14 +50,14 @@ def on_created(self, event: FileSystemEvent) -> None: if filePath.name in IGNORED_FILES: return - logging.getLogger("coretex").debug(f">> [Coretex] File created at path \"{filePath}\", adding to artifacts list") + logging.getLogger("coretexpylib").debug(f">> [Coretex] File created at path \"{filePath}\", adding to artifacts list") self.artifactPaths.append(filePath) def on_deleted(self, event: FileSystemEvent) -> None: filePath = Path(event.src_path) if filePath in self.artifactPaths: - logging.getLogger("coretex").debug(f">> [Coretex] Deleted file at path \"{filePath}\", removing from artifacts list") + logging.getLogger("coretexpylib").debug(f">> [Coretex] Deleted file at path \"{filePath}\", removing from artifacts list") self.artifactPaths.remove(filePath)