+
    NV-j  ã                   óÐ   € ^ RI t ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
Ht ] ! R R4      4       t] ! R R4      4       t ! R	 R
] P                  4      tR tR tR tR tR# )é    N)Ú	dataclassÚfield)ÚPath)ÚOptionalÚUnionc                   ó,   a € ] tR t^t o V 3R ltRtV tR# )ÚHostc                ó    <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[S[,          ;R&   S[S[S[S[S[S[,          3,          ,          ,          ;R&   # )é   ÚrankÚssh_hostnameÚipsÚrdma)ÚintÚstrÚlistr   r   )ÚformatÚ__classdict__s   "€Ún/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/mlx/_distributed_utils/common.pyÚ__annotate__ÚHost.__annotate__   sP   ø‡ ‚ á
�Iñ ñ Ññ ñ 
‰c��Nñ	 ñ
 ‰x™™c¡4©¥9˜nÕ-Õ.Õ
/Ñ/ò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r	   r	      s   ø‡ ‡ „ r   r	   c                   ól   a € ] tR t^t o Rt]! ]R7      tR t]	R 4       t
]	R	R l4       tV 3R ltRtV tR# )
ÚHostfileÚ )Údefault_factoryc                óÀ   € R V P                   RV P                  RV P                   Uu. uF)  pRVP                  RVP                  RVP
                  /NK+  	  up/# u upi )ÚbackendÚenvsÚhostsÚsshr   r   )r'   r(   r)   r   r   r   )ÚselfÚhs   & r   Úto_jsonÚHostfile.to_json   s^   € à�t—|‘|Ø�D—I‘IØàŸšóá#�Að ˜Ÿ™¨¨q¯u©u°f¸a¿f¹fÓEÙ#ñð
ð 	
ùòs   ¨/Ac                ó‚  € \        V4      pVP                  4       '       g   \        R\        V4       R24      h \        P
                  ! \        V4      4      pRp. p. p\        V\        4      '       d   VR,          pVR,          pVR,          pM\        V\        4      '       d   Tp\        V4       UUu. uF9  w  rg\        WgR,          VP                  R. 4      VP                  R	. 4      4      NK;  	  pppV ! WSV4      # u uppi   \         d+   p\        R
\        T4       R\        T4       R24      ThRp?ii ; i)a  Parse the json hostfile that contains both the hostnames to ssh into and
the ips to communicate over when using the ring backend. It can also
contain the backend to be used and environment variables to set when
launching a distributed job.

Example:

    {
        "backend": "jaccl",
        "envs": [
            "MLX_METAL_FAST_SYNCH=1"
        ],
        "hosts": [
            {"ssh": "hostname1", "ips": ["123.123.123.1"], "rdma": [null, "rdma_en2", "rdma_en3"]},
            {"ssh": "hostname2", "ips": ["123.123.123.2"], "rdma": ["rdma_en2", null, "rdma_en3"]},
            ...
            {"ssh": "hostnameN", "ips": ["123.123.123.N"], "rdma": ["rdma_en2", "rdma_en3", null]},
        ]
    }

Args:
    hostfile (str): The path to the json file containing the host
        information
z	Hostfile z doesn't existr$   r'   r(   r)   r*   r   r   zFailed to parse hostfile z (Ú)N)r   ÚexistsÚ
ValueErrorr   ÚjsonÚloadÚopenÚ
isinstanceÚdictr   Ú	enumerater	   ÚgetÚ	Exception)	ÚclsÚhostfileÚdatar'   r(   r)   Úir,   Úes	   &&       r   Ú	from_fileÚHostfile.from_file$   s.  € ô4 ˜“>ˆØ�‰× Ò Ü˜y¬¨X«¨°~ÐFÓGÐGð	Ü—9’9œT (›^Ó,ˆDØˆGØˆDØˆEÜ˜$¤×%Ò%Ø˜y�/�Ø˜F•|�Ø˜W�‘Ü˜D¤$×'Ò'Ø�ô & eÔ,ôá,‘D�Aô �Q˜%� !§%¡%¨¨rÓ"2°A·E±E¸&À"Ó4EÖFÙ,ð ñ ñ
 �u tÓ,Ð,ùóøô ô 	ÜØ+¬C°«M¨?¸"¼SÀ»V¸HÀAÐFóàðûð	ús*   »A=D	 Â8?DÃ7D	 ÄD	 Ä	D>Ä%D9Ä9D>c           
     ó6  € . p\        VP                  R 4      4       F_  w  rEVR8X  d   \        R4      h \        P                  ! V4       V.p\        V4       F  pVP                  \        WEV. 4      4       K!  	  Ka  	  V ! V4      #   \         d    . p LIi ; i)Ú,r$   zHostname cannot be empty)r8   Úsplitr2   Ú	ipaddressÚ
ip_addressÚrangeÚappendr	   )r;   ÚhostlistÚrepeatsr)   r>   r,   r   s   &&&    r   Ú	from_listÚHostfile.from_listZ   s•   € àˆÜ˜hŸn™n¨SÓ1Ö2‰DˆAØ�BŒwÜ Ð!;Ó<Ð<ðÜ×$Ò$ QÔ'Ø�c�ô ˜7–^�Ø—‘œT !¨¨RÓ0Ö1ó $ñ 3ñ �5‹zÐøô	 ô Ø’ðús   µBÂBÂBc                ó^   <€ V ^8„  d   Qh/ S[ S[,          ;R&   S[;R&   S[ S[,          ;R&   # )r   r)   r'   r(   )r   r	   r   )r   r   s   "€r   r   ÚHostfile.__annotate__   s2   ø‡ ‚ á‘�:Ññ ñ Ññ ñ ‰s�)Ñ1ò	 r   r   N)é   )r   r   r   r   r'   r   r   r(   r-   Úclassmethodr@   rK   r   r   r    r!   s   @r   r#   r#      sL   ø‡ € ð €GÙ¨DÔ1€Dò
ð ñ3ó ð3ðj óó ð÷O ƒ r   r#   c                   ó*   a € ] tR t^jt o RR ltRtV tR# )ÚOptionalBoolActionNc                ó�   € VP                  R 4      '       d   \        W P                  R4       R# \        W P                  R4       R# )z--no-FTN)Ú
startswithÚsetattrÚdest)r+   ÚparserÚ	namespaceÚvaluesÚoption_strings   &&&&&r   Ú__call__ÚOptionalBoolAction.__call__k   s/   € Ø×#Ñ# G×,Ò,Ü�IŸy™y¨%Ö0ä�IŸy™y¨$Ö/r   r   )N)r   r   r   r   r[   r   r    r!   s   @r   rR   rR   j   s   ø‡ € ÷0ò 0r   rR   c                 ó@   € \        V 4      p V ^ 8:  d   \        R4      hV # )r   zNumber should be positive)r   r2   )Úxs   &r   Úpositive_numberr_   r   s#   € ÜˆA‹€AØˆA„vÜÐ4Ó5Ð5Ø€Hr   c                 ób   € V '       g   R # \         P                  VR&   \        R.VORN5/ VB  R # )NÚfilez[32m[INFO]ú[0m©ÚsysÚstderrÚprint)ÚverboseÚargsÚkwargss   &*,r   Úlogrj   y   s-   € ßÙÜ—Z‘Z€Fˆ6�NÜ	Ð
Ð7˜TÐ7 9Ò7°Ô7r   c                  óN   € \         P                  VR &   \        R.V ORN5/ VB  R# )ra   z[33m[WARN]rb   Nrc   ©rh   ri   s   *,r   Úlog_warningrm   €   s'   € Ü—Z‘Z€Fˆ6�NÜ	Ð
Ð7˜TÐ7 9Ò7°Ô7r   c                  óN   € \         P                  VR &   \        R.V ORN5/ VB  R# )ra   z[31m[ERROR]rb   Nrc   rl   s   *,r   Ú	log_errorro   …   s'   € Ü—Z‘Z€Fˆ6�NÜ	Ð
Ð8˜dÐ8 IÒ8°Ô8r   )ÚargparserE   r3   rd   Údataclassesr   r   Úpathlibr   Útypingr   r   r	   r#   ÚActionrR   r_   rj   rm   ro   r   r   r   Ú<module>ru      sv   ðó Û Û Û 
ß (Ý ß "ð ÷0ð 0ó ð0ð ÷Rð Ró ðRôj0˜Ÿ™ô 0òò8ò8ô
9r   