
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddl	mZ dd	lmZ dd
lmZ ddlmZ dZ ej$                  ej&                  j(                         G d dej*                               Z ej$                  ej&                  j.                  ej&                  j0                         G d de             Zy)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                   D    e Zd ZdZej
                  Zed        Zd Z	d Z
y)CancelGAa  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                 0    t        j                  | d       y )Nz	to cancel)r
   AddCustomJobResourceArg)parsers    $lib/surface/ai/custom_jobs/cancel.pyArgszCancelGA.Args6   s    	!!&+6    c                      y)Ngcloud selfs    r   _CommandPrefixzCancelGA._CommandPrefix:   s    r   c                    |j                   j                  j                         }|j                         d   }t	        j
                  |       t        j                  | j                  |      5  |j                         }t        j                  | j                        j                  |      }t        j                  j                  t         j#                  || j%                                      |cd d d        S # 1 sw Y   y xY w)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   RunzCancelGA.Run=   s    ]]--335N""$]3Ff%		2	2!!&
2,,.h((##%%+VH%5 	jj
,
3
30C0C0E 4 GH 
2 
2 
2s   .BC;;DN)__name__
__module____qualname____doc__r   
GA_VERSIONr'   staticmethodr   r   r2   r   r   r   r   r   &   s0     %%,7 7r   r   c                   .    e Zd ZdZej
                  Zd Zy)CancelPreGAa  Cancel 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                 <    d| j                         j                  z   S )Nzgcloud )ReleaseTrackprefixr   s    r   r   zCancelPreGA._CommandPrefix\   s    t((*1111r   N)r3   r4   r5   r6   r   BETA_VERSIONr'   r   r   r   r   r:   r:   M   s    	 '',2r   r:   N)r6   
__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   r-   ReleaseTracksr<   GASilentCommandr   BETAALPHAr:   r   r   r   <module>rJ      s    3 &  ' 8 ( 3 7 ; @ #& " D%%(()#t!! # *#L D%%**D,=,=,C,CD2( 2 E2r   