U
    ÷Õ/e  ã                   @  sd   d dl mZ d dlmZ d dlmZmZ d dlmZm	Z	 d dl
mZ d dlmZ G dd„ deƒZd	S )
é    )Úannotations)Ú
Collection)ÚAnyÚLiteral)ÚDEFAULT_CLUSTER_DUMP_EXCLUDEÚDEFAULT_CLUSTER_DUMP_FORMAT)ÚSchedulerPlugin)Ú	Schedulerc                   @  sH   e Zd ZdZeefdddddœdd„Zd	d
dœdd„Zd
dœdd„ZdS )ÚClusterDumpa   Dumps cluster state prior to Scheduler shutdown

    The Scheduler may shutdown in cases where it is in an error state,
    or when it has been unexpectedly idle for long periods of time.
    This plugin dumps the cluster state prior to Scheduler shutdown
    for debugging purposes.
    ÚstrzCollection[str]zLiteral[('msgpack', 'yaml')]zdict[str, Any])ÚurlÚexcludeÚformat_Ústorage_optionsc                 K  s   || _ || _|| _|| _d S ©N)r   r   Úformatr   )Úselfr   r   r   r   © r   úH/tmp/pip-unpacked-wheel-g426oqom/distributed/diagnostics/cluster_dump.pyÚ__init__   s    zClusterDump.__init__r	   ÚNone)Ú	schedulerÚreturnc                 Ã  s
   || _ d S r   )r   )r   r   r   r   r   Ústart#   s    zClusterDump.start)r   c                 Ã  s&   | j j| j| j| jf| jŽI d H  d S r   )r   Zdump_cluster_state_to_urlr   r   r   r   )r   r   r   r   Úbefore_close&   s      ÿÿzClusterDump.before_closeN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r
      s   ür
   N)Ú
__future__r   Úcollections.abcr   Útypingr   r   Zdistributed.cluster_dumpr   r   Zdistributed.diagnostics.pluginr   Zdistributed.schedulerr	   r
   r   r   r   r   Ú<module>   s   