One Hat Cyber Team
Your IP :
3.135.198.165
Server IP :
192.145.235.60
Server :
Linux ngx365.inmotionhosting.com 5.14.0-427.33.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 30 09:45:56 EDT 2024 x86_64
Server Software :
Apache
PHP Version :
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
saltstack
/
salt
/
extras-3.10
/
rads
/
__pycache__
/
View File Name :
_locking.cpython-310.pyc
o �<�f � @ s� d Z ddlZddlZddlZddlZddlmZ ddlZG dd� de �Z ejddee fdd��Z d e _ej ddee dedee fd d��Zd e_dS )z&Functions for acquiring a process lock� N)�Optionalc @ s e Zd ZdZdZdS )� LockErrorz*Raised when a rads.lock cannot be acquired�radsN)�__name__� __module__�__qualname__�__doc__� r r �0/opt/saltstack/salt/extras-3.10/rads/_locking.pyr s r �namec c s� � | du rt j} | �d�} t�tjtj�}z|�dt�| �� � � W n tj y5 } zt| �|�d}~ww z dV W |�� dS |�� w )a� Context manager to create an abstract UNIX socket which will behave as a "lock". This can be used en lieu of /var/run file pids/locks to determine if an instance of a process is already running and ensure the lock is not left behind if the process terminates prematurely Args: name: unique name of the lock; defaults to filename of ``__main__`` Raises: LockError: if the "lock" already existed Nzutf-8z %s) �main_obj�__file__�encode�socket�AF_UNIX� SOCK_DGRAM�bind�hashlib�sha256� hexdigest�errorr �close)r Zlock_socket�excr r r �lock s � ��r r 皙�����?�sleep� max_sleepc c sz � d} zt | �� dV W d � W dS 1 sw Y W n ty; t�|� ||7 }|dur9||kr9� Y nw q)aQ Context manager to wait until a rads.lock() can be acquired, and do so Args: name: unique name of the lock; defaults to filename of ``__main__`` sleep: secs before trying to acquire the lock again max_sleep: max number of tries to acquire the lock Raises: LockError: if max_sleep is exceeded g TN)r r �timer )r r r �sleptr r r � wait_lock/ s � &� ���r )N)Nr N)r r r � contextlibr �typingr �__main__r � Exceptionr �contextmanager�strr r �float�intr r r r r �<module> s. ����