%PDF- %PDF-
| Direktori : /lib/python3.9/site-packages/ansible/module_utils/facts/__pycache__/ |
| Current File : //lib/python3.9/site-packages/ansible/module_utils/facts/__pycache__/timeout.cpython-39.pyc |
a
�)g� � @ sR d dl mZmZmZ eZd dlZd dlmZ dZ
dZG dd� de�Z
d dd�ZdS )
� )�absolute_import�division�print_functionN�
c @ s e Zd ZdS )�TimeoutErrorN)�__name__�
__module__�__qualname__� r
r
�F/usr/lib/python3.9/site-packages/ansible/module_utils/facts/timeout.pyr s r �
Timer expiredc s( � fdd�}t � �r$� }d� ||�S |S )z�
Timeout decorator to expire after a set number of seconds. This raises an
ansible.module_utils.facts.TimeoutError if the timeout is hit before the
function completes.
c s � �fdd�}|S )Nc s� �}|d u rt � �d�pt}tjdd�}|�� | |�}|�� zDz|�|�W W |�� S tj yv t d| ��Y n0 W |�� n
|�� 0 d S )N�GATHER_TIMEOUT� )Z processeszTimer expired after %s seconds)
�globals�get�DEFAULT_GATHER_TIMEOUT�mpZ
ThreadPoolZapply_async�closeZ terminate�multiprocessingr )�args�kwargsZ
timeout_value�pool�res)�func�secondsr
r �wrapper( s �z+timeout.<locals>.decorator.<locals>.wrapperr
)r r �r )r r � decorator'