optuna.storages.journal.JournalFileOpenLock
- class optuna.storages.journal.JournalFileOpenLock(filepath)[source]
Lock class for synchronizing processes for NFSv3 or later.
On acquiring the lock, open system call is called with the O_EXCL option to create an exclusive file. The file is deleted when the lock is released. This class is only supported when using NFSv3 or later on kernel 2.6 or later. In prior NFS environments, use
JournalFileSymlinkLock
.- Parameters:
filepath (str) – The path of the file whose race condition must be protected.
Methods
acquire
()Acquire a lock in a blocking way by creating a lock file.
release
()Release a lock by removing the created file.