Fix delete_after_upload when wait_for_upload=True was not supported

This commit is contained in:
allegroai 2020-11-17 23:10:08 +02:00
parent b656e0115f
commit 0e0b03157f

View File

@ -715,6 +715,11 @@ class Artifacts(object):
# noinspection PyProtectedMember # noinspection PyProtectedMember
if wait_on_upload: if wait_on_upload:
StorageManager.upload_file(local_file, uri) 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: else:
self._task._reporter._report(ev) self._task._reporter._report(ev)