Open
Description
I have a function which I run across multiple processes using the ray framework. This function temporarily allocates a huge portion of memory. To prevent memory errors due to too many of these allocations occurring at the same time, I want to use ilock.
The structure of my code is the following:
@ray.remote
def _do_work(in):
res1 = run_long_computations1(in)
with ilock.ILock('huge allocation'):
res2 = huge_allocation(res1)
res3 = run_fast_computation(res2)
del res2
return run_long_computations2(res3)
Most of the time it works perfectly, but occasionally, a FileNotFoundError
occurs which roots in ilock:
File "~/test.py", line 7, in _do_work
del res2
File "~/.anaconda3/envs/myenv/lib/python3.7/site-packages/ilock/__init__.py", line 59, in __exit__
os.unlink(self._filepath)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/ilock-9b91444836a91e7d27f6ca3479d5f0b728c7861f6622709ae0b4e2a38734655b.lock
Why is that? How to fix it?
Metadata
Metadata
Assignees
Labels
No labels