
                  	       V   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SSSS9r\R,                  " SS\R0                  " 5       \R2                  SS9r\R,                  " SSS\R0                  " 5       \R2                  SS9r\R,                  " SSSS9r\R,                  " S\R:                  " \\\S .S!9S"\R>                  " S#5      S$9r \R,                  " S%S&SS'S(9r!S) r"\RF                  4S* jr$g)+z4Flags definition specifically for gcloud ai ray job.    )absolute_import)division)unicode_literalsN)arg_parsers)base)concepts)	constants)flags)region_util)serverless_ray_jobs_util)labels_util)concept_parsersz--entrypointENTRYPOINT_FILE_URITz<The Ray job entrypoint Python file Google Cloud Storage URI.)metavarrequiredhelpz--entrypoint-file-argsARGz^Comma-separated arguments passed to Ray job python file. e.g. --entrypoint-file-args=arg1,arg2)r   typeactionr   z--archive-uriszComma-separated archive URIs that will be copy to the Ray nodes. e.g. --archive-uris=gs://test-bucket/test.tar.gz,gs://test-bucket/test2.tar.gz)r   hiddenr   r   r   z--container-image-uriCONTAINER_IMAGE_URIz7The container image URI to use for the Ray worker node.)r   r   z--resource-spec)zresource-unitz	disk-sizezmax-node-count)specRESOURCE_SPECa        Define the worker pool resource spec for the serverless ray job.

      The spec can contain the following fields:

      *resource-unit*::: Optional. Default to 1. Define how many compute resources(CPU, memory) on each worker node. By default we are using machine e2-standard series, and each resource unit allocates 4 vCPUs and 16GB memory. The resource-unit value can only be 1,2,4,8.
      *disk-size*::: Optional, default to 100. Disk size in GB on one worker node.
      *max-node-count*::: Optional, default to 2000. The max number of worker nodes this job can occupy while running.

      ::::
      Example:
      --resource-spec=resource-unit=2,disk-size=100,max-node-count=10
      )r   r   r   z--service-accountSERVICE_ACCOUNTzbThe service account to use for the Ray job. If not specified, the default service account is used.)r   r   r   c                    [         R                  " U S[        R                  " [        R
                  5      S9  [         R                  " S5      R                  U 5        [        R                  " U 5        [        R                  U 5        [        R                  U 5        [        R                  U 5        [        R                  U 5        [        R                  U 5        [        R                  U 5        g)z2Adds flags related to create a serverless ray job.zto create a serverless ray jobprompt_funcserverless ray jobN)shared_flagsAddRegionResourceArgr   GetPromptForRegionFuncr	   SUPPORTED_TRAINING_REGIONSGetDisplayNameArgAddToParserr   AddCreateLabelsFlags#_SERVERLESS_RAY_JOB_SERVICE_ACCOUNT_ENTRYPOINT_FILE_URI_RESOURCE_SPEC_ARCHIVE_URIS_ENTRYPOINT_JOB_FILE_ARGS_CONTAINER_IMAGE_URI)parsers    >lib/googlecloudsdk/command_lib/ai/serverless_ray_jobs/flags.pyAddCreateServerlessRayJobFlagsr.   j   s    ##&44

.
.   !56BB6J""6*%11&9""6*V$F#''/""6*    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 serverless ray job.

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 job 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serverless_ray_jobzThe serverless ray job {}.T)r   N)r   ResourceSpecr   SERVERLESS_RAY_JOB_COLLECTIONr   RegionAttributeConfigr   r!    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   ConceptParserForResourceformatr$   )r,   verbregionsresource_specs       r-   AddServerlessRayJobResourceArgrA      s     ''2PP(44!88A ::#- ++"))$/	 , 
 Kr/   )%__doc__
__future__r   r   r   textwrapgooglecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   googlecloudsdk.command_lib.air	   r
   r   r   1googlecloudsdk.command_lib.ai.serverless_ray_jobsr   $googlecloudsdk.command_lib.util.argsr   (googlecloudsdk.command_lib.util.conceptsr   Argumentr'   ArgListUpdateActionr*   r)   r+   ArgDictintdedentr(   r&   r.   r"   rA    r/   r-   <module>rR      sF   ; &  '  / ( 5 3 ? 5 V < D }}!	G	  !MM				##	,	  				##	U
 }}!	B  			 !

 	 
 
2 '+mm	,' #+, $>>r/   