Skip to content

Commit

Permalink
fix method
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Aug 28, 2023
1 parent 20af12a commit c88358c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/omero/hdfstorageV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import threading
import traceback

import os
from os import W_OK

import omero # Do we need both??
Expand Down Expand Up @@ -134,13 +135,11 @@ def addOrThrow(self, hdfpath, hdfstorage, read_only=False):
mode = read_only and "r" or "a"
hdffile = hdfstorage.openfile(mode)
fileno = hdffile.fileno()

if not read_only:
try:
portalocker.lock(
fileno, portalocker.LOCK_NB | portalocker.LOCK_EX)
portalocker.Lock(
hdfpath, flags=(portalocker.LOCK_NB | portalocker.LOCK_EX))
except portalocker.LockException:
hdffile.close()
raise omero.LockTimeout(
None, None,
"Cannot acquire exclusive lock on: %s" % hdfpath, 0)
Expand Down

0 comments on commit c88358c

Please sign in to comment.