
                              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 rS r	S	 r
S
 rS rS rS rS rS rSS jrS rS rSS jrS rS rS rS rS rS rS rS rSS jrS rg) z&Flag Utilities for cloud tpu commands.    )absolute_import)division)unicode_literals)arg_parsers)basec                  ,    [         R                  " SSS9$ )Ntpu_idzName of the TPU.helpr   Argument     4lib/googlecloudsdk/command_lib/compute/tpus/flags.pyGetTPUNameArgr      s    	
 r   c                  ,    [         R                  " SSS9$ )Nz--descriptionz(Specifies a text description of the TPU.r
   r   r   r   r   GetDescriptionFlagr      s    	5
7 7r   c                  4    [         R                  " SSS SSS9$ )z3Set argument for choosing the TPU Accelerator type.z--accelerator-typezv2-8c                 "    U R                  5       $ N)lower)xs    r   <lambda>(GetAcceleratorTypeFlag.<locals>.<lambda>*   s
    QWWYr   Fz`      TPU accelerator type for the TPU.
       If not specified, this defaults to `v2-8`.
      )defaulttyperequiredr   r   r   r   r   GetAcceleratorTypeFlagr   %   s$    	

 r   c                  .    [         R                  " SSSS9$ )z6Set argument for choosing the TPU Tensor Flow version.z	--versionTz      TensorFlow version for the TPU, such as `1.6`. For a list of available
      TensorFlow versions please see https://www.tensorflow.org/versions/.
      r   r   r   r   r   r   GetVersionFlagr!   2   s    	

 r   c                  .    [         R                  " SSSS9$ )zSet Cidr Range for Cloud TPU.z--rangeFa        CIDR Range for the TPU.
       The IP range that the TPU will select an IP address from.
       Must be in CIDR notation and a `/29` range, for example `192.168.0.0/29`.
       Errors will occur if the CIDR range has already been used for a
       currently existing TPU, the CIDR range conflicts with any networks
       in the user's provided network, or the provided network is peered with
       another network that is using that CIDR range.
      r    r   r   r   r   GetRangeFlagr#   =   s    	

 r   c                 (    U R                  SSSSSS9$ )Nz--preemptibleF
store_truez      Create a preemptible Cloud TPU, instead of a normal (non-preemptible) Cloud TPU. A
        preemptible Cloud TPU costs less per hour, but the Cloud TPU service can stop/terminate
        the node at any time.
      r   actionr   r   add_argumentparsers    r   AddPreemptibleFlagr,   M   s+    			
 
 	
 	r   c                 "    U R                  SSS9$ )Nexecution_group_namez*      The execution group name to delete. r
   r(   r*   s    r   AddTpuNameArgr/   Z   s"    			. 
 
 r   c                 "    U R                  SSS9$ )Nz--namezM      Override the name to use for VMs and TPUs (defaults to your username). r
   r(   r*   s    r   AddTpuNameOverrideArgr1   b   s#    			Q 
 
 r   c                 (    U R                  SSSSSS9$ )Nz--preemptible-vmFr%   z      Create a preemptible Compute Engine VM, instead of a normal (non-preemptible) VM.
        A preemptible VM costs less per hour, but the Compute Engine service can terminate the
        instance at any time.
      r&   r(   r*   s    r   AddPreemptibleVmFlagr3   j   s+    			
 
 	
 	r   Nc                 :    SnU R                  SSU=(       d    US9$ )Nz      Set the version of TensorFlow to use when creating the Compute Engine VM and the Cloud TPU.
        (It defaults to auto-selecting the latest stable release.)
      z--tf-versionFr    r(   r+   help_text_override	help_texts      r   AddTfVersionFlagr8   w   s1    
) 
		* 
 
 r   c                     Sn[        X5        g )Nz      Set the version of TensorFlow to the version originally set when creating the suspended Cloud TPU and Compute Engine VM .
        (It defaults to auto-selecting the latest stable release.)
      )r8   r+   r6   s     r   AddTfVersionFlagForResumer;      s    
 6.r   c                 (    U R                  SSSSSS9$ )Nz	--vm-onlyr%   Fzh      Do not allocate a TPU, only allocate a VM (useful if you're not ready to run on a TPU yet).
      r'   r   r   r   r(   r*   s    r   AddVmOnlyFlagr>      s+    			
 
 
 r   c                 >    SnU R                  SSSSU=(       d    US9$ )Nz      Do not allocate a VM, only allocate a TPU. To be used after the command has been run with a --vm-only flag
      and the user is ready to run on a TPU. Ensure that the name matches the name passed in when creating with the --vm-only flag.
      z
--tpu-onlyr%   Fr=   r(   r5   s      r   AddTpuOnlyFlagr@      s7    
) 
		* 
 
, ,r   c                     Sn[        X5      $ )Nz-    Do not delete VM, only delete the TPU.
  )r@   r:   s     r   AddTpuOnlyFlagForDeleterB      s     
	33r   c                 (    U R                  SSSSSS9$ )Nz--use-dl-imagesr%   Fa        Use Deep Learning VM Images (see docs - https://cloud.google.com/deep-learning-vm/) instead
      of TPU-specific machine images. Defaults to TPU-specific images. This
      value is set to true automatically if the --use-with-notebook flag is
      set to true.
      r=   r(   r*   s    r   AddDeepLearningImagesFlagrD      s+    			
 
 

 
r   c                 (    U R                  SSSSSS9$ )Nz	--dry-runFr%   zF      Do not make changes; print only what would have happened.
      r&   r(   r*   s    r   AddDryRunFlagrF      s+    			
 
 
 r   c                 &    U R                  SSSSS9$ )Nz--forward-portsstore_falseFz      Automatically forward useful ports from the Compute Engine VM to your local
        machine. The ports forwarded are: 6006 (tensorboard), 8888 (jupyter notebooks),
        8470 (TPU port), 8466 (TPU profiler port).
      )r'   r   r   r(   r*   s    r   AddPortForwardingFlagrI      s(    			
	 
 
 r   c                 "    U R                  SSS9$ )Nz--gce-imagez      Override the automatically chosen Compute Engine Image. Use this flag when you're using
        your own custom images instead of the provided ones with TensorFlow pre-installed.
      r
   r(   r*   s    r   AddGceImageFlagrK      s"    			
 
 
 r   c           
      P    U R                  SS[        R                  " SSS/S9SS9$ )	Nz--disk-size250GB20GB2000GBGB)lower_boundupper_boundsuggested_binary_size_scalesz      Configures the root volume size of your Compute Engine VM (in GB). The
      minimum size is 20GB and the maximum is 2000GB. Specified value must be an
      integer multiple of Gigabytes.
      )r   r   r   )r)   r   
BinarySizer*   s    r   AddDiskSizeFlagrU      s>    			!!(,v/
 
 
 r   c                 $    U R                  SSSS9$ )Nz--machine-typezn1-standard-1z      Specifies the machine type used for the Compute Engine VM. To get a
      list of available machine types, run 'gcloud compute
      machine-types list'. If unspecified, the default type is n1-standard-1.
      r   r   r(   r*   s    r   AddMachineTypeArgsrX      s%    			
 
 
 r   c                 (    U R                  SSSSSS9$ )Nz--use-with-notebookr%   Fz      Allow Compute Engine VM to be recognized by Cloud AI Notebooks. This
      automatically sets the content of the flag --use-dl-images flag to be
      true.
      r=   r(   r*   s    r   AddUseWithNotebookrZ      s+    			
 
 

 
r   c                 :    SnU R                  SSU=(       d    US9$ )Nz    Specifies the network the Cloud TPU and associated VM should be created in.
    If unspecified, the network "default" is picked.
    z	--networkr   rW   r(   r5   s      r   AddNetworkArgsr\      s1    ) 
		* 
 
, ,r   c                     Sn[        X5      $ )Nz    Set to the network that was originally used creating the suspended Cloud TPU
    and Compute Engine VM. (It defaults to using the 'default' network.)
    )r\   r:   s     r   AddNetworkArgsForResumer^     s     
	33r   r   )__doc__
__future__r   r   r   googlecloudsdk.callioper   r   r   r   r   r!   r#   r,   r/   r1   r3   r8   r;   r>   r@   rB   rD   rF   rI   rK   rU   rX   rZ   r\   r^   r   r   r   <module>rb      s    - &  ' / (7
 

	/
,4	,4r   