
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlm
Z ddlmZ d	Zej"                   ej$                  d
ee       ej&                  ej(                  j*                  ej(                  j,                  ej(                  j.                         G d dej0                                             Z G d de      Zy)zICommand for describing the status of the TPU node and GCE VM combination.    )absolute_import)division)unicode_literals)HttpNotFoundError)base)flags)utilzThis command is deprecated and will be removed in a future release. We recommend that you use the TPU-VM or Queued Resource API. See https://cloud.google.com/tpu/docs/managing-tpus-tpu-vm for more information.F)
is_removedwarningerrorc                   &    e Zd ZdZed        Zd Zy)DescribezDescribe Google Compute TPU + VM combination.

  ## EXAMPLES

  To describe the TPU and VM combination, run:

    $ {command} test-execution-group --zone=test-zone --project=test-project

  c                     t        j                  |dd       t        j                  |       |j                  j                  d       y )Ntpudescribe)resource_typeoperation_typeztable(Field, Value))r   AddZoneFlag
tpus_flagsAddTpuNameArgdisplay_info	AddFormat)clsparsers     5lib/surface/compute/tpus/execution_groups/describe.pyArgszDescribe.Args6   s7    	fE*MV$
!!"78    c                 6   t         j                  j                  |       g }t        j                  | j	                               }	 |j                  |j                  |j                        }|j                  t        d|j                  xr* |j                  d   xr |j                  d   j                               |j                  t        d|j                               |j                  t        d|j                               t        j                  | j	                               }d }	 |j                  |j                  |j                        }|rl|j                  t        d|j                                |j                  t        d	|j"                  xr* |j"                  d   xr |j"                  d   j$                               |j                  t        d
|j&                               |j                  t        d|j(                               |j                  t        d|j*                               |j                  t        d|j,                               |j                  t        d|j.                               |j                  t        d|j0                  xr |j0                  j2                               |S # t        $ r  |j                  t        dd             |cY S w xY w# t        $ r |j                  t        dd             Y w xY w)NzExecution Group Status:z	Not Foundz#Compute Engine Instance IP Address:r   zCompute Engine Created:zCompute Engine Machine Type:zTPU Node status:zTPU Accelerator Type:zTPU IP Address:zTPU TF Version:zTPU Service Account:zTPU Created:z
TPU State:zTPU Health:zTPU Preemptible:)	tpu_utilsDefaultArgsValidateZoneInstanceReleaseTrackGetexecution_group_namezoner   append	GetResultnetworkInterfaces	networkIPcreationTimestampmachineTypeTPUNodeacceleratorTypenetworkEndpoints	ipAddresstensorflowVersionserviceAccount
createTimestatehealthschedulingConfigpreemptible)selfargs	responsesinstance_helperinstancenode_helpernodes          r   RunzDescribe.Run<   s   &&t,I(():):)<=O $$T%>%>		Jh 1&& 48+E+Ea+H 4&&q)33	56
 +X-G-GHJ0(2F2FGI ##D$5$5$78KDC__T66		Bd y!8$:N:NOP
!6!6 "1##A&"1##A&0023
 y!2D4J4JKLy!79L9LMNyABytzz:;y<=
&(=(= )6))5578 S   
-{
;=,  Cy!3[ABCs$   &K -&K0 &K-,K-0$LLN)__name__
__module____qualname____doc__classmethodr   r?    r   r   r   r   $   s      9 9
0r   r   c                       e Zd Zd Zd Zy)r(   c                      || _         || _        y N)fieldvalue)r8   status_fieldstatus_values      r   __init__zGetResult.__init__q   s    DJDJr   c                 4    | j                   |j                   kD  S rH   )rI   )r8   lrs     r   __gt__zGetResult.__gt__u   s    ::  r   N)r@   rA   rB   rM   rP   rE   r   r   r(   r(   o   s    !r   r(   N)rC   
__future__r   r   r   apitools.base.py.exceptionsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   'googlecloudsdk.command_lib.compute.tpusr   8googlecloudsdk.command_lib.compute.tpus.execution_groupsr	   r   _DEPRECATION_WARNINGDefaultUniverseOnly	DeprecateReleaseTracksr#   GABETAALPHADescribeCommandr   objectr(   rE   r   r   <module>r`      s    P &  ' 9 ( 4 G V   
  D%%(($*;*;*@*@%%++-At## A-	  AH! !r   