
    ,                         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SS.r " S S\R$                  5      rg)zList job command.    )absolute_import)division)unicode_literals)	constants)dataproc)display_helper)util)base)flags)
propertiesACTIVE
NON_ACTIVE)activeinactivec                   >    \ rS rSrSr\S 5       rS r\S 5       rSr	g)List"   at  List jobs in a project.

List jobs in a project. An optional filter can be used to constrain the jobs
returned. Filters are case-sensitive and have the following syntax:

  [field = value] AND [field [= value]] ...

where `field` is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
key. `value` can be ```*``` to match all values. `status.state` can be either
`ACTIVE` or `INACTIVE`. Only the logical `AND` operator is supported;
space-separated items are treated as having an implicit `AND` operator.

## EXAMPLES

To see the list of all jobs in Dataproc's 'us-central1' region, run:

  $ {command} --region=us-central1

To see a list of all active jobs in cluster 'mycluster' with a label
`env=staging` located in 'us-central1', run:

  $ {command} --region=us-central1 --filter='status.state = ACTIVE AND
      placement.clusterName = 'mycluster' AND labels.env = staging'
c                 x   [         R                  R                  U 5        [         R                  R	                  U [
        R                  5        [        R                  " U 5        U R                  SSS9  U R                  S[        [        R                  5       5      SS9  U R                  R                  S5        g )Nz	--clusterz.Restrict to the jobs of this Dataproc cluster.)helpz--state-filterzFilter by job state.)choicesr   z
          table(
            reference.jobId,
            jobType.yesno(no="-"):label=TYPE,
            status.state:label=STATUS
          )
    )r
   URI_FLAGRemoveFromParserPAGE_SIZE_FLAG
SetDefaultr   DEFAULT_PAGE_SIZEr   AddRegionFlagadd_argumentsortedSTATE_MATCHER_ENUM_MAPkeysdisplay_info	AddFormat)parsers    !lib/surface/dataproc/jobs/list.pyArgs	List.Args<   s    MM""6*""69+F+FG	
=  ? -2245#  % !! # 	    c           
         [         R                  " U R                  5       5      n[        R                  R
                  R                  R                  5       n[        R                  " 5       nU R                  UR                  X4U5      nUR                  (       a  UR                  Ul        UR                  (       aS  [        R!                  UR                  5      nUR                  R"                  R$                  R'                  U5      Ul        [        R*                  " SUR,                  R.                  UUR0                  SUR2                  SS9nS U 5       $ )Nz&The following jobs are unreachable: %sjobspageSize)limitfield
batch_sizebatch_size_attributec              3   N   #    U  H  n[         R                  " U5      v   M     g 7f)N)r   DisplayHelper).0jobs     r$   	<genexpr>List.Run.<locals>.<genexpr>l   s     >#N((--s   #%)dpDataprocReleaseTrackr   VALUEScoreproject	GetOrFailr	   ResolveRegion
GetRequestmessagesclusterclusterNamestate_filterr   get&DataprocProjectsRegionsJobsListRequestJobStateMatcherValueValuesEnumlookup_by_namejobStateMatcher YieldFromListWithUnreachableListclientprojects_regions_jobsr+   	page_size)selfargsr   r:   regionrequeststater)   s           r$   RunList.RunR   s    {{4,,./H$$,,668G!Fooh//$GG|| LLg$(():):;e



B
B))..*?  000--jj>>'D ?>>r'   c                 n    S nUR                   (       a  UR                   nS Ul         U R                  XUS9$ )N)	projectIdrM   filter)rT   rC   )r>   r:   rM   rL   backend_filters        r$   r=   List.GetRequestn   s?     N{{{{ndk:: ; A Ar'    N)
__name__
__module____qualname____firstlineno____doc__staticmethodr%   rP   r=   __static_attributes__rW   r'   r$   r   r   "   s6    2 	 	*?8 	A 	Ar'   r   N)r\   
__future__r   r   r   googlecloudsdk.api_lib.dataprocr   r   r5   r   r	   googlecloudsdk.callioper
   #googlecloudsdk.command_lib.dataprocr   googlecloudsdk.corer   r   ListCommandr   rW   r'   r$   <module>re      sK      &  ' 5 : : 0 ( 5 * %-,G VA4 VAr'   