Introduce the file locker utility
This is a general purpose file locker.
If the lock file already exists and it contains the current process
id in it, we wait until the timeout for the lock to be released,
raising an AlreadyLocked exception when the timeout is reached.
If the lock file already exists and it contains a pid of another
running process, we raise an AlreadyLocked exception.
If the lock file exists and it has no running processes pid in it,
we try to clean the file and acquire the lock, raising a LockFailed
exception when something goes wrong.
Signed-off-by: NAmador Pahim <apahim@redhat.com>
Showing
avocado/utils/filelock.py
0 → 100644
想要评论请 注册 或 登录