ó
    €Ï´  ã                   óX   • S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	r	S r
S	 rg)
z9SSH/SCP utilities for Cloud TPU Queued Resource commands.é    )Úabsolute_import)Údivision)Úunicode_literals)Ú
exceptions)ÚlogNc                 ó"  • [        U5      n[        R                  " U 5      R                  5       S:X  a  [	        [        U5      5      nGO[        5       nU R                  S5      nU Hì  nU(       d  M  SU;   a¿  UR                  S5      n[        U5      S:w  d  US   (       a
  US   (       d&  [        R                  " SSR                  U5      5      e[        US   5      [        US   5      p‡Xx:¼  a&  [        R                  " SSR                  U5      5      eUR                  [        XxS-   5      5        MÑ   UR                  [        U5      5        Mî     U(       d&  [        R                  " SS
R                  U 5      5      e[        U5      n	X’:¼  a)  [        R                  " SSR                  X’S-
  5      5      e/ n
U H  nU
R!                  X   5        M     U
$ ! [         a'    [        R                  " SS	R                  U5      5      ef = f)z1Parses the --node flag into a list of node_specs.ÚALLÚ,Ú-é   r   é   z--nodezaRange "{}" does not match expected format "lowerBound-upperBound", where lowerBound < upperBound.z4unable to parse node ID {}. Please only use numbers.z$Unable to parse node ranges from {}.z‰node index {} is larger than the valid node indices on this TPU Queued Resource. Please only use indexes in the range [0, {}], inclusive.)ÚlenÚsixÚ	text_typeÚupperÚlistÚrangeÚsetÚsplitr   ÚInvalidArgumentExceptionÚformatÚintÚupdateÚaddÚ
ValueErrorÚmaxÚappend)Ú	node_flagÚ
node_specsÚ	num_nodesÚindexesÚrangesÚrÚboundsÚstartÚendÚmxÚfiltered_node_specsÚnodes               ÚClib/googlecloudsdk/command_lib/compute/tpus/queued_resources/ssh.pyÚParseNodeFlagr+      så  € ä*‹o€)Ü‡]‚]9Ó×#Ñ#Ó%¨Ó.Ü”5˜Ó#Ó$‚Gä‹e€GØ_‰_˜SÓ!€FÛˆÞÙØ	‹Ø—‘˜“ˆÜˆv‹;˜!Ó 6¨!§9°F¸1·IÜ×3Ò3ØðIßIOÉØóJóð ô ˜ ™“^¤S¨°©£^ˆsØ‹<Ü×3Ò3ØðIßIOÉØóJóð ð 	‰”u˜U¨!¡GÓ,Ö-ð	Ø
+‰+”c˜!“fÖ
ñ3 ö@ 
Ü
×
-Ò
-ØØ.×5Ñ5°iÓ@óð ô
 ˆ7ƒ|€"Øƒ_Ü
×
-Ò
-Øð	Nç	‰ ‘MÓ	"ó	ð ð ÐÛ€dØ×Ñ˜zÑ/Ö0ñ à	Ðøô3 ó 	Ü×3Ò3ØØD×KÑKÈAÓNóð ð	ús   Ä9GÇ1Hc                 óÊ   • U  H  nUR                  5         M     U HD  nU(       d  M  [        R                  R                  SR	                  UR
                  5      5        MF     g)z“Waits for the completion of batch, but does not block for failures.

Args:
  ssh_threads: List of ssh threads.
  nodes: List of SSH prepped nodes.
zFinished preparing node {}.N)Újoinr   ÚstatusÚPrintr   Útpu_name)Ússh_threadsÚnodesÚ
ssh_threadr)   s       r*   ÚWaitForNodeBatchCompletionr4   X   sK   € ó  €jØ‡OOÖñ  ó €dß€tÜ	‡jj×ÑÐ4×;Ñ;¸D¿M¹MÓJÖKò ó    )Ú__doc__Ú
__future__r   r   r   Úgooglecloudsdk.callioper   Úgooglecloudsdk.corer   r   r+   r4   © r5   r*   Ú<module>r;      s)   ðñ @å &Ý Ý 'å .Ý #Û 
ò;ó|Lr5   