Remove temporary model files after failed writes
This commit is contained in:
parent
fb31b3ed83
commit
f629b16cd2
1 changed files with 21 additions and 4 deletions
|
|
@ -146,11 +146,13 @@ class LargeFileBase(ABC):
|
|||
) -> Literal[False]:
|
||||
self._file.close()
|
||||
|
||||
if type is None:
|
||||
if "w" in self._mode:
|
||||
self.push(Path(self._file.name))
|
||||
if "w" in self._mode:
|
||||
try:
|
||||
if type is None:
|
||||
self.push(Path(self._file.name))
|
||||
finally:
|
||||
os.unlink(self._file.name)
|
||||
else:
|
||||
elif type is not None:
|
||||
logger.exception("Could not finish operation.")
|
||||
|
||||
return False
|
||||
|
|
|
|||
Loading…
Reference in a new issue