Skip to content

Commit

Permalink
try to remove with suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Nov 18, 2024
1 parent 25e55d2 commit 6282552
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions antarest/matrixstore/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ def save(self, content: t.Union[t.List[t.List[MatrixData]], npt.NDArray[np.float
# Avoid having to save the matrix again (that's the whole point of using a hash).
return matrix_hash

lock_file = matrix_path.with_suffix(".tsv.lock") # use tsv lock to stay consistent with old data
lock_file = matrix_path.parent.joinpath(
f"{matrix_hash}.tsv.lock"
) # use tsv lock to stay consistent with old data
for internal_format in InternalMatrixFormat:
matrix_in_another_format_path = self.bucket_dir.joinpath(f"{matrix_hash}.{internal_format}")
if matrix_in_another_format_path.exists():
Expand Down Expand Up @@ -280,5 +282,5 @@ def delete(self, matrix_hash: str) -> None:

# IMPORTANT: Deleting the lock file under Linux can make locking unreliable.
# Abandoned lock files are deleted here to maintain consistent behavior.
lock_file = matrix_path.with_suffix(".tsv.lock")
lock_file = matrix_path.parent.joinpath(f"{matrix_hash}.tsv.lock")
lock_file.unlink(missing_ok=True)

0 comments on commit 6282552

Please sign in to comment.