Server IP : 192.158.238.246 / Your IP : 3.135.218.109 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python38/lib/python3.8/site-packages/lockfile/__pycache__/ |
Upload File : |
U ��UV� � @ st d Z ddlmZ ddlZddlZddlZddlmZmZm Z m Z mZmZ G dd� de�Z dd � Zd d� Zdd � ZdS )z8 Lockfile behaviour implemented via Unix PID files. � )�absolute_importN� )�LockBase� AlreadyLocked� LockFailed� NotLocked� NotMyLock�LockTimeoutc @ sL e Zd ZdZddd�Zdd� Zdd � Zd d� Zddd �Zdd� Z dd� Z dS )�PIDLockFileaA Lockfile implemented as a Unix PID file. The lock file is a normal file named by the attribute `path`. A lock's PID file contains a single line of text, containing the process ID (PID) of the process that acquired the lock. >>> lock = PIDLockFile('somefile') >>> lock = PIDLockFile('somefile') FNc C s t �| |d|� | j| _d S )NF)r �__init__�pathZunique_name)�selfr Zthreaded�timeout� r �E/opt/alt/python38/lib/python3.8/site-packages/lockfile/pidlockfile.pyr $ s zPIDLockFile.__init__c C s t | j�S )z- Get the PID from the lock file. )�read_pid_from_pidfiler �r r r r �read_pid* s zPIDLockFile.read_pidc C s t j�| j�S )zv Test if the lock is currently held. The lock is held if the PID file for this lock exists. )�osr �existsr r r r � is_locked/ s zPIDLockFile.is_lockedc C s | � � ot�� | �� kS )z� Test if the lock is held by the current process. Returns ``True`` if the current process ID matches the number stored in the PID file. )r r �getpidr r r r r �i_am_locking7 s zPIDLockFile.i_am_lockingc C s� |dk r|n| j }t�� }|dk r2|dkr2||7 }zt| j� W n� tk r� } zt|jtjkr�t�� |kr�|dk r�|dkr�td| j ��ntd| j ��t� |dk r�|d p�d� nt d| j ��W 5 d}~X Y q2X dS q2dS )z� Acquire the lock. Creates the PID file for this lock, or raises an error if the lock could not be acquired. Nr z&Timeout waiting to acquire lock for %sz%s is already locked� g�������?zfailed to create %s)r �time�write_pid_to_pidfiler �OSError�errno�EEXISTr r �sleepr )r r �end_time�excr r r �acquire? s&