
    <                        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(                         G d dej*                               Z ej$                  ej&                  j.                  ej&                  j0                         G d de             Zy)z:Command to check stream logs of a custom 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j
                  Zed        Zd Z	y)StreamLogsGAShow stream logs from a running custom job.

    ## EXAMPLES

    To stream logs of custom job ``123'' under project ``example'' in region
    ``us-central1'', run:

      $ {command} 123 --project=example --region=us-central1
  c                     t        j                  | d       t        j                  |        | j                  j                  t        j                         y )Nzto fetch stream log)custom_job_flagsAddCustomJobResourceArgcommon_flagsAddStreamLogsFlagsdisplay_info	AddFormatr   
LOG_FORMAT)parsers    )lib/surface/ai/custom_jobs/stream_logs.pyArgszStreamLogsGA.Args-   s;    ,,V5JK##F+
!!("5"56    c                    |j                   j                  j                         }|j                         d   }t	        j
                  |       t        j                  | j                  |      5  t        j                  |j                         d   t        j                  | j                        j                  |j                               |j                  |j                   |j"                        cd d d        S # 1 sw Y   y xY w)NlocationsId)versionregioncustomJobsId)r   )continue_functionpolling_interval	task_nameallow_multiline)CONCEPTS
custom_jobParseAsDictr   ValidateRegionr	   AiplatformEndpointOverrides_api_versionr   
StreamLogsr   CustomJobsClientCheckJobCompleteRelativeNamer"   r#   allow_multiline_logs)selfargscustom_job_refr   s       r   RunzStreamLogsGA.Run3   s    ]]--335N""$]3Ff%		2	2!!&
2  



!.
1"33''))9)9 --/*100NN335
2 
2 
2s   .BC<<DN)
__name__
__module____qualname____doc__r   
GA_VERSIONr+   staticmethodr   r4    r   r   r   r      s+     %%,7 7
5r   r   c                   (    e Zd ZdZej
                  Zy)StreamLogsPreGAr   N)r5   r6   r7   r8   r   BETA_VERSIONr+   r;   r   r   r=   r=   D   s     '',r   r=   N)r8   
__future__r   r   r   %googlecloudsdk.api_lib.ai.custom_jobsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   r
   r   r   )googlecloudsdk.command_lib.ai.custom_jobsr   r   ReleaseTracksReleaseTrackGACommandr   BETAALPHAr=   r;   r   r   <module>rJ      s    A &  ' 8 ( 3 7 ? 2 O @ D%%(()!54<< !5 *!5H D%%**D,=,=,C,CD
(l 
( E
(r   