optuna.storages.JournalFileSymlinkLock

class optuna.storages.JournalFileSymlinkLock(filepath)[source]

Lock class for synchronizing processes for NFSv2 or later.

On acquiring the lock, link system call is called to create an exclusive file. The file is deleted when the lock is released. In NFS environments prior to NFSv3, use this instead of JournalFileOpenLock

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 symbolic link of a file.

release()

Release a lock by removing the symbolic link.

acquire()[source]

Acquire a lock in a blocking way by creating a symbolic link of a file.

Returns:

True if it succeeded in creating a symbolic link of self._lock_target_file.

Return type:

bool

release()[source]

Release a lock by removing the symbolic link.

Return type:

None