
                             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  G d dej                        Zy)zCommand for listing job tasks.    )absolute_import)division)unicode_literals)commands)connection_context)flags)pretty_print)resource_args)serverless_operations)concept_parsers)presentation_specsc                   @    e Zd ZdZdddZed        Zed        Zd Zy)	ListzList tasks.z#
          {description}
          zl
          To list all tasks for an execution:

              $ {command} --execution=my-execution
         )DESCRIPTIONEXAMPLESc                 `   t        j                  dt        j                         ddd      }t	        j
                  |g      j                  |       t        j                  |       |j                  j                  dj                  t        j                  t        j                               y )Nz--executionz"Execution for which to list tasks.TF)requiredprefixesztable({ready_column},index,running_state:label=STATE,name:label=TASK,start_time.date("%Y-%m-%d %H:%M:%S %Z"):label=STARTED,completion_time.date("%Y-%m-%d %H:%M:%S %Z"):label=COMPLETED,retries):({alias}))ready_columnalias)r   ResourcePresentationSpecr
   GetExecutionResourceSpecr   ConceptParserAddToParserr   AddTaskFilterFlagsdisplay_info	AddFormatformatr	   READY_COLUMNr   SATISFIES_PZS_ALIAS)clsparserexecution_presentations      -lib/surface/run/jobs/executions/tasks/list.py
CommonArgszList.CommonArgs/   s    /HH..0, !!#9":;GGO	V$
!!	 $V%22.. $ 
    c                 &    | j                  |       y N)r%   )r!   r"   s     r$   Argsz	List.ArgsG   s    NN6r&   c                    |j                   j                  j                         }t        j                  |t
        j                  j                  | j                               }t        j                  |      5 }| j                  |j                         |j                  |j                         |j                         |j                   xs d      }t#        |d       cddd       S # 1 sw Y   yxY w)zList tasks of a job execution.Nc                     | j                   S r(   )index)xs    r$   <lambda>zList.Run.<locals>.<lambda>U   s    qwwr&   )key)CONCEPTS	executionParser   GetConnectionContextr   ProductRUNReleaseTrackr   ConnectSetCompleteApiEndpointendpoint	ListTasksParentNamefilter_flagssorted)selfargsexecution_refconn_contextclientrets         r$   RunzList.RunK   s    MM++113M%::emm!2!2!46L		&	&|	4
!!,"7"78]113]5G5G5I!..6$8cC./	 
5	4	4s   7A&C''C0N)	__name__
__module____qualname____doc__detailed_helpclassmethodr%   r)   rE    r&   r$   r   r      sC    -  .  
0r&   r   N)rI   
__future__r   r   r   googlecloudsdk.command_lib.runr   r   r   r	   r
   r   (googlecloudsdk.command_lib.util.conceptsr   r   r   rL   r&   r$   <module>rP      s;    % &  ' 3 = 0 7 8 @ D G608== 60r&   