X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/650265966e83fca4ce8e9a416e9b5e358e82be98..ff3645c9c262f5a2aca67ba42ba86084d0e9978a:/sdk/python/arvados/diskcache.py diff --git a/sdk/python/arvados/diskcache.py b/sdk/python/arvados/diskcache.py index 74b2a77b28..15afa23a8d 100644 --- a/sdk/python/arvados/diskcache.py +++ b/sdk/python/arvados/diskcache.py @@ -36,15 +36,18 @@ class DiskCacheSlot(object): try: if value is None: self.content = None + self.ready.set() return if len(value) == 0: # Can't mmap a 0 length file self.content = b'' + self.ready.set() return if self.content is not None: # Has been set already + self.ready.set() return blockdir = os.path.join(self.cachedir, self.locator[0:3]) @@ -66,6 +69,8 @@ class DiskCacheSlot(object): tmpfile = None self.content = mmap.mmap(self.filehandle.fileno(), 0, access=mmap.ACCESS_READ) + # only set the event when mmap is successful + self.ready.set() finally: if tmpfile is not None: # If the tempfile hasn't been renamed on disk yet, try to delete it.