
    
                     \   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  ej$                  ej&                  j(                  ej&                  j*                  ej&                  j,                         G d dej.                               Zy)zICommand to check stream logs of a hyperparameter tuning job in Vertex AI.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)flags)log_util)
validationc                   &    e Zd ZdZed        Zd Zy)
StreamLogszStream logs from a running Vertex AI hyperparameter tuning job.

     ## EXAMPLES

     To stream logs of a hyperparameter tuning job, run:

     $ {command} stream-logs HP_TUNING_JOB
  c                     t        j                  | d       t        j                  |        | j                  j                  t        j                         y )Nzto fetch stream log)hp_tuning_job_flagsAddHptuningJobResourceArgcommon_flagsAddStreamLogsFlagsdisplay_info	AddFormatr   
LOG_FORMAT)parsers    ,lib/surface/ai/hp_tuning_jobs/stream_logs.pyArgszStreamLogs.Args+   s;    11&:OP##F+
!!("5"56    c                    |j                   j                  j                         }|j                         d   }t	        j
                  |t        j                         | j                         t        j                  j                  k(  rt        j                  nt        j                  }t        j                  ||      5  |j                         }t!        j"                  |j                         d   t%        j&                  |      j)                  |      |j*                  |j,                  |j.                        cd d d        S # 1 sw Y   y xY w)NlocationsId)available_regions)versionregionhyperparameterTuningJobsId)r   )continue_functionpolling_interval	task_nameallow_multiline)CONCEPTShptuning_jobParseAsDictr   ValidateRegionr   SUPPORTED_TRAINING_REGIONSReleaseTrackr   GA
GA_VERSIONBETA_VERSIONr	   AiplatformEndpointOverridesRelativeNamer   r   r   HpTuningJobsClientCheckJobCompleter"   r#   allow_multiline_logs)selfargshptuning_job_refr   r   relative_names         r   RunzStreamLogs.Run1   s   }}11779$$&}5F)"F"FH '+&7&7 '					'i""#,#9#9 		2	2
(&335m  

!
!
#$@
A"55//>00NN335
( 
( 
(s   ?A<EEN)__name__
__module____qualname____doc__staticmethodr   r8    r   r   r   r      s      7 7
5r   r   N)r<   
__future__r   r   r   (googlecloudsdk.api_lib.ai.hp_tuning_jobsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   r
   r   r   r   ,googlecloudsdk.command_lib.ai.hp_tuning_jobsr   ReleaseTracksr+   r,   BETAALPHACommandr   r>   r   r   <module>rH      s    P &  ' ; ( 3 7 ? 2 4 U D%%(($*;*;*@*@%%++-!5 !5-!5r   