+
    –°³jk  ã                   óØ   € ^ RI HtHt ^ RIHt ^ RIHt ^ RIt]P                  P                  t
RtRtRtRt^t. ROt]R	 R
 l4       tR R ltRR R lltR R ltR R ltRR R lltR# )é    )ÚCallableÚIterable)Úcontextmanager)Ú	timedeltaNz/num_membersz/last_memberz/TRACEz/TRACING_GATEc                ó$   € V ^8„  d   QhR\         /# )é   Útimeout)Úfloat)Úformats   "Úf/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/distributed/elastic/utils/store.pyÚ__annotate__r      s   € ÷ #ñ #¤%ñ #ó    c              #  ó†   "  € V P                   pV P                  \        VR7      4       Rx € V P                  V4       R# 5i)z«
This sets the timeout and then restores the old timeout when the context
manager exits.

Args:
    store: the store to set the timeout on
    timeout: the timeout to set
©ÚsecondsN)r	   Úset_timeoutr   )Ústorer	   Úold_timeouts   && r   Ústore_timeoutr      s4   é € ð —-‘-€KØ	×Ñ”i¨Ô0Ô1Û	Ø	×Ñ�kÖ"ùs   ‚?Ac                ó<   € V ^8„  d   QhR\         R\        R\         /# )r   ÚrankÚprefixÚ
world_size©ÚintÚstr)r   s   "r   r   r   .   s!   € ÷  ñ  œð  ¤cð  ´sñ  r   c                ó¾   € T P                  \        V4       Uu. uF  qB V 2NK
  	  up4      p\        V VV R2R7      pV^ 8X  d   V P                  V.4       V# u upi )a4  
Given a store and a prefix, the method goes through the array of keys
of the following format: ``{prefix}{idx}``, where idx is in a range
from 0 to size, and tries to retrieve the data.

The Rank0 process waits at the end to make sure all other processes
finished the procedure before exiting.

Usage

::

 values = get_all(store, "torchelastic/data", 3)
 value1 = values[0]  # retrieves the data for key torchelastic/data0
 value2 = values[1]  # retrieves the data for key torchelastic/data1
 value3 = values[2]  # retrieves the data for key torchelastic/data2

z	/finished©r   r   Ú
key_prefix)Ú	multi_getÚrangeÚ_barrier_nonblockingÚwait)r   r   r   r   ÚidxÚdata_arrÚbarrier_keys   &&&&   r   Úget_allr'   .   sm   € ð& �‰¼EÀ*Ô<MÓNÑ<M°S (¨3¨%Ó 0Ñ<MÑNÓO€Hä&ØØØ�X˜YÐ'ô€Kð
 ˆq„yð 	�
‰
�K�=Ô!à€Oùò  Os   ™Ac                óv   € V ^8„  d   QhR\         R\        R\        R\        R\        R\        \         ,          /# )r   Údatar   r   r   r	   Úreturn)Úbytesr   r   r
   Úlist)r   s   "r   r   r   Q   sJ   € ÷ ñ ä
ðô ðô ð	ô
 ðô ðô 
Œ%…[ñr   c                ó®   € \        W4      ;_uu_ 4        V P                  V V 2V4       \        WWC4      pVuuRRR4       #   + '       g   i     R# ; i)a<  
Synchronizes ``world_size`` agents between each other using the underlying c10d store.
The ``data`` will be available on each of the agents.

Note: The data on the path is not deleted, as a result there can be stale data if
    you use the same key_prefix twice.

Time complexity: O(N) per worker, O(N^2) globally.
N)r   Úsetr'   )r   r)   r   r   r   r	   Ú
agent_datas   &&&&&& r   Úsynchronizer0   Q   sD   € ô" 
�u×	&Õ	&Ø�	‰	�Z�L  Ð'¨Ô.Ü˜U¨*ÓAˆ
Ø÷ 
'×	&×	&Ó	&ús   ”$AÁA	c                ó¨   € V ^8„  d   QhR\         R\        R\         R\        \         .\        3,          R\        R\        \        ,          R,          /# )r   r   r   r   Úrank_decoderÚtrace_timeoutr*   N)r   r   r   r
   r   )r   s   "r   r   r   h   sZ   € ÷ ,ñ ,äð,ô ð,ô ð	,ô
 œC˜5¤#˜:Õ&ð,ô ð,ô Œc…]�TÕñ,r   c                 óÊ   a aaaa€ S P                  S V \         2R 4       VVV VV3R lpVVV 3R lpV^ 8X  d$   V! 4       pS P                  S \         2R 4       V# V! 4       # )ú<val_ignored>c                  óv  <€ \        4       p ^ p\        ^S4       Fi  pV\        8¼  d    V #  V^ 8X  d*   SP                  S V \         2.\        SR7      4       KB  SP                  S V \         2.\        ^R7      4       Kk  	  V #   \         d%    T^,          pT P                  S! T4      4        K�  i ; i)r   r   )Úmilliseconds)r.   r!   Ú_MAX_TRACE_MISSING_RANKSr#   Ú_TRACEr   ÚDistStoreErrorÚadd)Úmissing_rank_infoÚranks_missingÚir   r2   r   r3   r   s      €€€€€r   Ú_find_missing_ranksÚ9_try_detecting_missing_ranks.<locals>._find_missing_ranksr   sÅ   ø€ Ü›EÐØˆÜ�q˜*Ö%ˆAð Ô 8Ô8Øð !Ð ð
7Ø  AÔ%Ø—J‘JØ&˜<¨ s¬6¨(Ð3Ð4´iÈÔ6Vöð
 —J‘J : ,¨q¨c´&°Ð :Ð;¼YÐTUÔ=VÖWñ &ð  !Ð øô "ô 7Ø Õ"�Ø!×%Ñ%¡l°1£o×6ð7ús   ¬.B	Á'B	Â	+B8Â7B8c                  óx   <€  SP                  S  \         2.4       R S! ^ 4       R2.#   \         d     R# i ; i)z[<check rank 0 (z) for missing rank info>]N)r#   Ú_TRACING_GATEr:   )r   r2   r   s   €€€r   Ú_checkinÚ._try_detecting_missing_ranks.<locals>._checkin‡   sJ   ø€ ð	Ø�J‰J˜:˜,¤} oÐ6Ð7Ô8Ø&¡|°A£Ð&7Ð7PÐQÐRÐRøÜô 	âð	ús   ƒ&* ª9¸9)r.   r9   rB   )	r   r   r   r   r2   r3   r?   rC   r<   s	   fff&ff   r   Ú_try_detecting_missing_ranksrE   h   sf   ü€ ð 
‡I�I��˜T˜F¤6 (Ð+¨_Ô=÷!ñ !÷*ð ˆq„yÙ/Ó1ÐØ�	‰	�Z�L¤ Ð0°/ÔBØ Ð á‹zÐr   c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   r   r   r*   r   )r   s   "r   r   r   —   s!   € ÷ ñ ¬Cð ¼Sð ÄSñ r   c                óŽ   € V\         ,           pV\        ,           pV P                  V^4      pWQ8X  d   V P                  VR4       V# )ze
Does all the non-blocking operations for a barrier and returns the final key
that can be waited on.
r5   )Ú_NUM_MEMBERSÚ_LAST_MEMBER_CHECKINr;   r.   )r   r   r   Únum_members_keyÚlast_member_keyr$   s   &&&   r   r"   r"   —   sC   € ð
 !¤<Õ/€OØ Ô#7Õ7€Oà
�)‰)�O QÓ
'€CØ
ÔØ�	‰	�/ ?Ô3àÐr   c                ó¤   € V ^8„  d   QhR\         R\        R\        R\         R,          R\        \         .\        3,          R,          R\        RR/# )	r   r   r   Úbarrier_timeoutr   NÚrank_tracing_decoderr3   r*   )r   r   r
   r   )r   s   "r   r   r   ¦   sd   € ÷ <ñ <äð<ô ð<ô ð	<ô
 ��*ð<ô #¤C 5¬# :Õ.°Õ5ð<ô ð<ð 
ñ<r   c                ó¦  € Vf   Ve   \        R4      h\        W4      ;_uu_ 4        \        WVR7      p V P                  V.4        RRR4       R#   \         d_   pTf   Th\        T TTTT;'       g    R T4      p	T	e3   \	        RP                  TTTRRP                  T	4       R2T4      4      RhThRp?ii ; i  + '       g   i     R# ; i)	aH  
A global lock between agents. This will pause all workers until at least
``world_size`` workers respond.

This uses a fast incrementing index to assign waiting ranks and a success
flag set by the last worker.

Time complexity: O(1) per worker, O(N) globally.

Optionally, passing rank will enable tracing of missing ranks on timeouts.
`rank_tracing_decoder` lambda arg can be used to convert rank data
into a more meaningful information at an app level (e.g. hostname).

Note: Since the data is not removed from the store, the barrier can be used
    once per unique ``key_prefix``.
Nz!Tracing requires rank informationr   c                 ó   € \        V 4      # )N)r   )Úxs   &r   Ú<lambda>Úbarrier.<locals>.<lambda>Ó   s   € ´s¸1´vr   ziTimed out waiting on barrier on rank {}, for key prefix: {} (world_size={}, missing_ranks={}, timeout={})Ú[z, Ú])ÚAssertionErrorr   r"   r#   r:   rE   r   Újoin)
r   r   r   rM   r   rN   r3   rK   ÚeÚmissing_rankss
   &&&&&&&   r   ÚbarrierrZ   ¦   só   € ð4 ‚|ØÒ+Ü Ð!DÓEÐEä	�u×	.Õ	.Ü.Ø¸:ô
ˆð	Ø�J‰J˜Ð(Õ)÷ 
/Ñ	.øô ô 	ØŠ|Ø�ä <ØØØØØ(×>Ð>Ñ-=Ø!ó!�ð !Ò,Ü(ðdßdjÑdjØ Ø&Ø&Ø §	¡	¨-Ó 8Ð9¸Ð;Ø+óeó	ð  ð	 ð �Gûð1	ú÷ 
/×	.Ð	.ús/   §B?¶AÁB<ÁB7Á6AB7Â7B<Â<B?Â?C	)r   r'   r0   rZ   )é,  )r[   NNé
   )Úcollections.abcr   r   Ú
contextlibr   Údatetimer   ÚtorchÚ_CÚ_DistStoreErrorr:   rH   rI   r9   rB   r8   Ú__all__r   r'   r0   rE   r"   rZ   © r   r   Ú<module>re      s{   ð÷ /Ý %Ý ã ð —‘×)Ñ)€à€Ø%Ð Ø	€Ø€ØÐ ò A€ð ô#ó ð#õ  ÷Fõ.,õ^÷<ñ <r   