
    4                     `   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dlmZ dZ ej&                  ej(                  j*                  ej(                  j,                  ej(                  j.                         G d dej0                               Zy)z;Command to cancel a hyperparameter tuning job in Vertex AI.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)
validation)flags)hp_tuning_jobs_util)logzRequest to cancel hyperparameter tuning job [{id}] has been sent.

You may view the status of your job with the command

  $ gcloud{command_version} ai hp-tuning-jobs describe {id} --region={region}
c                   &    e Zd ZdZed        Zd Zy)Cancela  Cancel a running hyperparameter tuning 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   AddHptuningJobResourceArg)parsers    'lib/surface/ai/hp_tuning_jobs/cancel.pyArgszCancel.Args6   s    	##FK8    c           
         |j                   j                  j                         }|j                         d   }t	        j
                  |t        j                         | j                         t        j                  j                  k(  rt        j                  nt        j                  }t        j                  ||      5  t        j                   |      j#                  |j%                               }t&        j(                  j+                  t,        j/                  |j1                         t3        j4                  | j                               |             |cd d d        S # 1 sw Y   y xY w)NlocationsId)available_regions)versionregion)r   )idcommand_versionr   )CONCEPTShptuning_jobParseAsDictr
   ValidateRegionr   SUPPORTED_TRAINING_REGIONSReleaseTrackr   GA
GA_VERSIONBETA_VERSIONr	   AiplatformEndpointOverridesr   HpTuningJobsClientr   RelativeNamer   statusPrint$_HPTUNING_JOB_CANCEL_DISPLAY_MESSAGEformatNamer   OutputCommandVersion)selfargshptuning_job_refr   r   responses         r   Runz
Cancel.Run:   s!   }}11779$$&}5F)"F"FH '+&7&7 '					'i""#,#9#9 		2	2
(**7;BB

'
'
)+h 
jj
.
5
5!&&(1FF##%'	 6  
( 
( 
(s   ?BE""E+N)__name__
__module____qualname____doc__staticmethodr   r4    r   r   r   r   '   s     
 9 9r   r   N)r8   
__future__r   r   r   (googlecloudsdk.api_lib.ai.hp_tuning_jobsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   r
   ,googlecloudsdk.command_lib.ai.hp_tuning_jobsr   r   googlecloudsdk.corer   r,   ReleaseTracksr#   r$   BETAALPHASilentCommandr   r:   r   r   <module>rE      s    B &  ' ; ( 3 7 4 > L #( $ D%%(($*;*;*@*@%%++-$T $-$r   