From 0e0b03157fca1125ea2f2dedc3f5cdc848d2f121 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Tue, 17 Nov 2020 23:10:08 +0200 Subject: [PATCH] Fix delete_after_upload when wait_for_upload=True was not supported --- trains/binding/artifacts.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trains/binding/artifacts.py b/trains/binding/artifacts.py index b7c2880f..546a3efb 100644 --- a/trains/binding/artifacts.py +++ b/trains/binding/artifacts.py @@ -715,6 +715,11 @@ class Artifacts(object): # noinspection PyProtectedMember if wait_on_upload: StorageManager.upload_file(local_file, uri) + if delete_after_upload: + try: + os.unlink(local_file) + except OSError: + LoggerRoot.get_base_logger().warning('Failed removing temporary {}'.format(local_file)) else: self._task._reporter._report(ev)