
                            S r SSKJr  SSKJr  SSKJr  SSK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Jr  SSKJr  SSKJr  SSKJr  \R,                  " S\R.                  " S5      S9r\R,                  " SS\R2                  " \\\\\\\\\S.	S9S\R.                  " S5      S9r\R,                  " SSS\R.                  " S5      S9rS r\R>                  4S jr g) z4Flags definition for gcloud ai persistent-resources.    )absolute_import)division)unicode_literalsN)arg_parsers)base)concepts)	constants)flags)region_util)persistent_resource_util)labels_util)concept_parsersz--configa        Path to the Persistent Resource configuration file. This file should be a
      YAML document containing a list of `ResourcePool`
      If an option is specified both in the configuration file **and** via
      command-line arguments, the command-line arguments override the
      configuration file. Note that keys with underscore are invalid.

      Example(YAML):

        resourcePoolSpecs:
          machineSpec:
            machineType: n1-standard-4
          replicaCount: 1)helpz--resource-pool-specappend)	zreplica-countzmin-replica-countzmax-replica-countzmachine-typezaccelerator-typezaccelerator-countz	disk-typez	disk-sizezlocal-ssd-count)specRESOURCE_POOL_SPECa	        Defines a resource pool to be created in the Persistent Resource. You can
      include multiple resource pool specs in order to create a Persistent
      Resource with multiple resource pools.

      The spec can contain the following fields:

      *machine-type*::: (Required): The type of the machine.
        see https://cloud.google.com/vertex-ai/docs/training/configure-compute#machine-types
        for supported types. This field corresponds to the `machineSpec.machineType`
        field in `ResourcePool` API message.
      *replica-count*::: (Required if autoscaling not enabled) The number of
        replicas to use when creating this resource pool. This field
        corresponds to the replicaCount field in 'ResourcePool' API message.
      *min-replica-count*::: (Optional) The minimum number of replicas that
        autoscaling will down-size to for this resource pool. Both
        min-replica-count and max-replica-count are required to enable
        autoscaling on this resource pool. The value for this parameter must be
        at least 1.
      *max-replica-count*::: (Optional) The maximum number of replicas that
        autoscaling will create for this resource pool. Both min-replica-count
        and max-replica-count are required to enable autoscaling on this
        resource pool. The maximum value for this parameter is 1000.
      *accelerator-type*::: (Optional) The type of GPU to attach to the
        machines.
        see https://cloud.google.com/vertex-ai/docs/training/configure-compute#specifying_gpus
        for more requirements. This field corresponds to the `machineSpec.acceleratorType`
        field in `ResourcePool` API message.
      *accelerator-count*::: (Required with accelerator-type) The number of GPUs
        for each VM in the resource pool to use. The default the value if 1.
        This field corresponds to the `machineSpec.acceleratorCount` field in
        `ResourcePool` API message.
      *disk-type*::: (Optional) The type of disk to use for each machine's boot disk in
        the resource pool. The default is `pd-standard`. This field corresponds
        to the `diskSpec.bootDiskType` field in `ResourcePool` API message.
      *disk-size*::: (Optional) The disk size in Gb for each machine's boot disk in the
        resource pool. The default is `100`. This field corresponds to
        the `diskSpec.bootDiskSizeGb` field in `ResourcePool` API message.


      ::::
      Example:
      --worker-pool-spec=replica-count=1,machine-type=n1-highmem-2
      )actiontypemetavarr   z--enable-custom-service-account
store_trueFzm      Whether or not to use a custom user-managed service account with this
      Persistent Resource.
      )r   requiredr   c                 n   [         R                  " U S[        R                  " [        R
                  5      S9  [         R                  R                  U 5        [        R                  U 5        [         R                  " U S5        [        R                  " U 5        [         R                  " SSS9R                  U 5        [        R                  " SSS	S
S9nUR                  U 5        [        R                  " SSS9nUR!                  ["        5        UR!                  [$        5        UR                  U 5        g	)z3Adds flags related to create a Persistent Resource.zto create a Persistent Resourceprompt_funcpersistent resourcezPersistent ResourceFr   z--persistent-resource-idTNz-User-specified ID of the Persistent Resource.)r   defaultr   zresource pool specification.)r   r   )shared_flagsAddRegionResourceArgr   GetPromptForRegionFuncr	   SUPPORTED_TRAINING_REGIONSNETWORKAddToParserENABLE_CUSTOM_SERVICE_ACCOUNTAddKmsKeyResourceArgr   AddCreateLabelsFlagsGetDisplayNameArgr   ArgumentArgumentGroupAddArgument_PERSISTENT_RESOURCE_CONFIG_RESOURCE_POOL_SPEC)parserresource_id_flagresource_pool_spec_groups      ?lib/googlecloudsdk/command_lib/ai/persistent_resources/flags.py AddCreatePersistentResourceFlagsr1   z   s    ##'44

.
.01
 ""6*++F3 ##F,AB""6*  !6*/11<V1D]] :	<
 v&!//)D &&'BC&&':;&&v.    c           	      4   [         R                  " [        R                  S[        R
                  " [        R                  " U5      S9[         R                  SS9n[        R                  R                  SUSR                  U5      SS9R                  U 5        g	)
a+  Add a resource argument for a Vertex AI Persistent Resource.

NOTE: Must be used only if it's the only resource arg in the command.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
  regions: list[str], the list of supported regions.
r   r   F)resource_collectionresource_namelocationsId
projectsIddisable_auto_completerspersistent_resourcezThe persistent resource {}.Tr   N)r   ResourceSpecr   PERSISTENT_RESOURCE_COLLECTIONr   RegionAttributeConfigr   r     DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   ConceptParserForResourceformatr#   )r-   verbregionsresource_specs       r0    AddPersistentResourceResourceArgrD      s     ''2QQ)44!88AC::#%- ++#**40	 ,  ![(r2   )!__doc__
__future__r   r   r   textwrapgooglecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   googlecloudsdk.command_lib.air	   r
   r   r   2googlecloudsdk.command_lib.ai.persistent_resourcesr   $googlecloudsdk.command_lib.util.argsr   (googlecloudsdk.command_lib.util.conceptsr   r(   dedentr+   ArgDictintstrr,   r$   r1   r!   rD    r2   r0   <module>rS      s    ; &  '  / ( 5 3 ? 5 W < D #mm	  
   mm			 !$!$ #!$"


 !	 +
 +
!; z !%%	 
 
	! /D $>>)r2   