File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/asynchronous.cpython-310.pyc
Back
o ;jv � @ s^ d Z ddlZddlZddlZddlZddlZddlZe�e �Z ejdd� �ZG dd� d�Z dS )z; Helpers/utils for working with tornado asynchronous stuff � Nc c s: � t jjjj�� }| �� z dV W |�� dS |�� w )zW A context manager that will set the current ioloop to io_loop for the context N)�salt�ext�tornado�ioloop�IOLoop�current�make_current)�io_loopZ orig_loop� r �K/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/asynchronous.py�current_ioloop s �r c @ sd e Zd ZdZ ddd�Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� ZdS )�SyncWrappera� A wrapper to make Async classes synchronous This is uses as a simple wrapper, for example: asynchronous = AsyncClass() # this method would regularly return a future future = asynchronous.async_method() sync = SyncWrapper(async_factory_method, (arg1, arg2), {'kwarg1': 'val'}) # the sync wrapper will automatically wait on the future ret = sync.async_method() Nc C s� t jjjjdd�| _|d u rg }|d u ri }|d u rg }|d u r"g }|| _|| _|r0| j|| j<