
                            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SKJr  SSKJr  SSKJr  Sr\R.                  " \R0                  R2                  5       " S S\R4                  5      5       r\R.                  " \R0                  R8                  \R0                  R:                  5       " S S\5      5       rg)z,Command to create a custom job in Vertex AI.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)
validation)custom_jobs_util)flags)labels_util)log)
propertiesa'  CustomJob [{job_name}] is submitted successfully.

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

  $ {command_prefix} ai custom-jobs describe {job_name}

or continue streaming the logs with the command

  $ {command_prefix} ai custom-jobs stream-logs {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.     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
c                 0    [         R                  " U 5        g )N)r   AddCreateCustomJobFlags)parsers    $lib/surface/ai/custom_jobs/create.pyArgsCreateGA.Args@   s    	!!&)    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._DisplayResultD   sf    J!!C$++-4444jJJ.55]]: 	6 	?@r   c                 &   UR                   (       a  UR                  UR                   S5      OUR                  S5      " 5       n[        R                  " XU R
                  5        [        [        R                  " UR                  =(       d    / UR                  U5      5      n[        R                  " UUUUR                  UR                  UR                  UR                  UR                   UR"                  UR$                  UR&                  S9nU$ )NCustomJobSpec)
base_configworker_pool_specsnetworkservice_accountenable_web_accessenable_dashboard_accessargscommandpython_package_uripersistent_resource_id)configImportResourceMessage
GetMessager
   ValidateCreateArgs_versionlistr   +UpdateWorkerPoolSpecsIfLocalPackageRequiredworker_pool_specdisplay_nameConstructCustomJobSpecr0   r1   r2   r3   r4   r5   python_package_urisr7   )r'   r4   
api_clientproject
job_configr/   job_specs          r   _PrepareJobSpecCreateGA._PrepareJobSpecM   s    )- 11_&:D:O:O; ;  !!$DMMBDD!!'R):):G	EF  66+,,00 $ < <YY33#::<H Or   c           	         [         R                  R                  R                  R	                  5       nUR
                  R                  R                  5       nUR                  5       S   n[        R                  " U5        [        R                  " U R                  US9   [        R                  " U R                  S9nU R!                  XU5      n["        R$                  " UUR'                  5       R(                  5      nUR+                  UR-                  5       UR.                  U[0        R2                  " U5      US9nU R5                  U5        UsS S S 5        $ ! , (       d  f       g = f)NlocationsId)versionregion)rK   )parentr@   rF   kms_key_namelabels)r   VALUEScorerD   	GetOrFailCONCEPTSrL   ParseAsDictr
   ValidateRegionr	   AiplatformEndpointOverridesr<   r   CustomJobsClientrG   r   ParseCreateArgsCustomJobMessageLabelsValueCreateRelativeNamer@   common_validationGetAndValidateKmsKeyr*   )	r'   r4   rD   
region_refrL   rC   rF   rO   r(   s	            r   RunCreateGA.Runf   s    $$,,668G%%++-J /Ff%		2	2f
.**4==Aj%%d@h**


%
%
'
3
35f ""((*(((==dC # h (#
. 
. 
.s   B1E
E( N)__name__
__module____qualname____firstlineno____doc__r   
GA_VERSIONr<   staticmethodr   r*   rG   ra   __static_attributes__rc   r   r   r   r   .   s6     !!(* *@2r   r   c                   0    \ rS rSrSr\R                  rSrg)CreatePreGA~   r   rc   N)	rd   re   rf   rg   rh   r   BETA_VERSIONr<   rk   rc   r   r   rm   rm   ~   s     ##(r   rm   N)rh   
__future__r   r   r   %googlecloudsdk.api_lib.ai.custom_jobsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   r
   r^   )googlecloudsdk.command_lib.ai.custom_jobsr   r   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   r$   ReleaseTracksr    GACreateCommandr   BETAALPHArm   rc   r   r   <module>r|      s    3 &  ' 8 ( 3 7 I F ; @ < # *
* & D%%(()Lt!! L *L^ D%%**D,=,=,C,CD$( $ E$r   