
                            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	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rSr\R*                  " \R,                  R.                  5      \R0                   " S S\R2                  5      5       5       r\R*                  " \R,                  R6                  5       " S S\5      5       rg)z4Command to create a serverless ray job in Vertex AI.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)flags)serverless_ray_jobs_util)labels_util)logzFprojects/{project_number}/locations/{region}/operations/{operation_id}zServerless Ray Job [{job_name}] is submitted successfully.

Your job is still active. You may view the status of your job with the command:

  $ {command_prefix} ai ray job describe {job_name}

c                   R    \ rS rSrSr\R                  r\S 5       r	S r
S rS rSrg)	CreateGA,   aw  Create a new serverless ray job.

This command will attempt to run the serverless ray job immediately upon
creation.

## EXAMPLES

To create a job under project ``example'' in region
``us-central1'', run:

  $ {command} --region=us-central1 --project=example
  --resource-spec=resource-unit=1,disk-size=100
  --entrypoint='gs://test-project/ray_job.py'
  --display-name=test
c                 0    [         R                  " U 5        g )N)r
   AddCreateServerlessRayJobFlags)parsers     lib/surface/ai/ray/job/submit.pyArgsCreateGA.ArgsA   s    	((0    c                     SnU R                  5       R                  (       a   USU R                  5       R                  -   -  n[        R                  R	                  [
        R                  UR                  US95        g )Ngcloud )job_namecommand_prefix)ReleaseTrackprefixr   statusPrint&_JOB_CREATION_DISPLAY_MESSAGE_TEMPLATEformatname)selfresponse
cmd_prefixs      r   _DisplayResultCreateGA._DisplayResultE   se    J!!C$++-4444jJJ.55]]: 	6 	
r   c           
          [         R                  " UUR                  UR                  UR                  UR
                  UR                  UR                  S9nU$ )N)main_python_file_urientrypoint_file_argsarchive_urisservice_accountcontainer_image_uriresource_spec)r   ConstructServerlessRayJobSpec
entrypointr+   r,   r-   r.   r/   )r$   args
api_clientjob_specs       r   _PrepareJobSpecCreateGA._PrepareJobSpecP   sP    'EE!__!66&&,, 44((H Or   c                 `   UR                   R                  R                  5       nUR                  5       S   n[        R
                  " U R                  US9   [        R                  " U R                  S9n[        SR                  U R                  5      5        U R                  X5      n[        R                  " XR                  5       R                  5      nUR!                  UR#                  5       UUR$                  US9nU R'                  U5        UsS S S 5        $ ! , (       d  f       g = f)NlocationsId)versionregion)r9   zself._version: {})parentr4   display_namelabels)CONCEPTSr:   ParseAsDictr	   AiplatformEndpointOverrides_versionr   ServerlessRayJobsClientprintr"   r5   r   ParseCreateArgsServerlessRayJobMessageLabelsValueCreateRelativeNamer<   r'   )r$   r2   
region_refr:   r3   r4   r=   r%   s           r   RunCreateGA.Run]   s    %%++-J /F		2	2f
.11$--Hj&&t}}56%%d7h**
224@@f ""((*((	 # h (#'
. 
. 
.s   B>D
D- N)__name__
__module____qualname____firstlineno____doc__r   
GA_VERSIONrB   staticmethodr   r'   r5   rK   __static_attributes__rM   r   r   r   r   ,   s5      !!(1 1	r   r   c                   0    \ rS rSrSr\R                  rSrg)CreatePreGAx   a  Create a new custom job.

This command will attempt to run the custom job immediately upon creation.

## EXAMPLES

To create a job under project ``example'' in region
``us-central1'', run:

  $ {command} --region=us-central1 --project=example
  --worker-pool-spec=replica-count=1,machine-type='n1-highmem-2',container-image-uri='gcr.io/ucaip-test/ucaip-training-test'
  --display-name=test
rM   N)	rN   rO   rP   rQ   rR   r   BETA_VERSIONrB   rU   rM   r   r   rW   rW   x   s     ##(r   rW   N)rR   
__future__r   r   r   -googlecloudsdk.api_lib.ai.serverless_ray_jobsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   1googlecloudsdk.command_lib.ai.serverless_ray_jobsr
   r   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   !_OPERATION_RESOURCE_NAME_TEMPLATEr!   ReleaseTracksr   GAUniverseCompatibleCreateCommandr   BETArW   rM   r   r   <module>rg      s    ; &  ' @ ( 3 7 C V < # M "* & D%%(()Gt!! G  *GT D%%**+$( $ ,$r   