
                            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r\R$                  " \R&                  R(                  5       " S S\R*                  5      5       r\R$                  " \R&                  R.                  \R&                  R0                  5       " S S\5      5       rg)z,Command to cancel a custom job in Vertex AI.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)flags)
validation)logzRequest to cancel CustomJob [{job_name}] has been sent.

You may view the status of your job with the command

  $ {command_prefix} ai custom-jobs describe {job_name}
c                   L    \ rS rSrSr\R                  r\S 5       r	S r
S rSrg)CancelGA&   a  Cancel a running custom job.

If the job is already finished,
the command will not perform any operation.

## EXAMPLES

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

  $ {command} 123 --project=example --region=us-central1
c                 2    [         R                  " U S5        g )Nz	to cancel)r
   AddCustomJobResourceArg)parsers    $lib/surface/ai/custom_jobs/cancel.pyArgsCancelGA.Args6   s    	!!&+6    c                     g)Ngcloud selfs    r   _CommandPrefixCancelGA._CommandPrefix:   s    r   c                 
   UR                   R                  R                  5       nUR                  5       S   n[        R
                  " U5        [        R                  " U R                  US9   UR                  5       n[        R                  " U R                  S9R                  U5      n[        R                  R                  [         R#                  X@R%                  5       S95        UsS S S 5        $ ! , (       d  f       g = f)NlocationsId)versionregion)r    )job_namecommand_prefix)CONCEPTS
custom_jobParseAsDictr   ValidateRegionr	   AiplatformEndpointOverrides_api_versionRelativeNamer   CustomJobsClientCancelr   statusPrint"_CUSTOM_JOB_CANCEL_DISPLAY_MESSAGEformatr   )r   argscustom_job_refr!   r"   responses         r   RunCancelGA.Run=   s    ]]--335N""$]3Ff%		2	2!!&
2,,.h((##%%+VH%5 	jj
,
3
30C0C0E 4 GH 
2 
2 
2s   -A=C44
Dr   N)__name__
__module____qualname____firstlineno____doc__r   
GA_VERSIONr*   staticmethodr   r   r5   __static_attributes__r   r   r   r   r   &   s0     %%,7 7r   r   c                   6    \ rS rSrSr\R                  rS rSr	g)CancelPreGAM   zCancel a running custom job.

If the job is already finished,
the command will not perform any operation.

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

  $ {command} 123 --project=example --region=us-central1
c                 <    SU R                  5       R                  -   $ )Nzgcloud )ReleaseTrackprefixr   s    r   r   CancelPreGA._CommandPrefix\   s    t((*1111r   r   N)
r7   r8   r9   r:   r;   r   BETA_VERSIONr*   r   r>   r   r   r   r@   r@   M   s    	 '',2r   r@   N)r;   
__future__r   r   r   %googlecloudsdk.api_lib.ai.custom_jobsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   )googlecloudsdk.command_lib.ai.custom_jobsr
   r   googlecloudsdk.corer   r0   ReleaseTracksrC   GASilentCommandr   BETAALPHAr@   r   r   r   <module>rR      s    3 &  ' 8 ( 3 7 ; @ #& " D%%(()#t!! # *#L D%%**D,=,=,C,CD2( 2 E2r   