
                         "   S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKrSSKJ	r	  SSK
r
 " S S\R                  5      r\R                  " S	S
S/5      r\R                  " SSS/5      r " S S\
R                   " \R"                  \5      5      rg)az  Abstract operation class that command operations will inherit from.

Should typically be executed in a task iterator through
googlecloudsdk.command_lib.storage.tasks.task_executor.

Manual execution example:

>>> class CopyTask(Task):
...   def __init__(self, src, dest):
...     ...
>>> my_copy_task = new CopyTask('~/Desktop/memes.jpg', '/kernel/')
>>> my_copy_task.Execute()
    )absolute_import)division)unicode_literalsN)debug_outputc                   <    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrg)Topic+   z$Categorizes different task messages.api_download_resultchange_exit_codecrc32ccreated_resourceerrorfatal_errormd5set_iam_policyuploaded_component N)__name__
__module____qualname____firstlineno____doc__API_DOWNLOAD_RESULTCHANGE_EXIT_CODECRC32CCREATED_RESOURCEERRORFATAL_ERRORMD5SET_IAM_POLICYUPLOADED_COMPONENT__static_attributes__r       4lib/googlecloudsdk/command_lib/storage/tasks/task.pyr   r   +   s8    ,-'&'
% +##.+r#   r   MessagetopicpayloadOutputadditional_task_iteratorsmessagesc                   V    \ rS rSrSrS r\R                  S	S j5       rS
S jr	S r
Srg)Task`   a)  Abstract class to represent one command operation.

Attributes:
  change_exit_code (bool): If True, failure of this task should update the
    exit_code to 1. Defaults to True.
  parallel_processing_key (Optional[Hashable]): Identifies a task during
    execution. If this value is not None, the executor will skip this task if
    another task being executed is using the same key. If this value is None,
    the executor will not skip any tasks based on it.
  received_messages (Iterable[Message]): Messages sent to this task
    by its dependencies.
c                 .    SU l         S U l        / U l        g )NTr   parallel_processing_keyreceived_messagesselfs    r$   __init__Task.__init__n   s     D#'D Dr#   Nc                     g)zPerforms some work based on class attributes.

Args:
  task_status_queue (multiprocessing.Queue): Used by task to report it
    progress to a central location.

Returns:
  An Output instance, or None.
Nr   )r3   task_status_queues     r$   executeTask.executes   s     	r#   c                     AAg)ax  Task executor calls this method on a completed task before discarding it.

An example use case is a subclass that needs to report its final status and
if it failed or succeeded at some operation.

Args:
  error (Exception|None): Task executor may pass an error object.
  task_status_queue (multiprocessing.Queue): Used by task to report it
    progress to a central location.
Nr   )r3   r   r7   s      r$   exit_handlerTask.exit_handler   s     	 r#   c                 .    [         R                  " U 5      $ N)r   generic_reprr2   s    r$   __repr__Task.__repr__   s    $$T**r#   r/   r>   )NN)r   r   r   r   r   r4   abcabstractmethodr8   r;   r@   r"   r   r#   r$   r,   r,   `   s0     
 
	 
		+r#   r,   )r   
__future__r   r   r   rB   collectionsenumgooglecloudsdk.core.utilr   sixEnumr   
namedtupler%   r(   with_metaclassABCMetaobjectr,   r   r#   r$   <module>rN      s     '  ' 
   1 
,DII ,* 
 
 i4 
		 *-
/+3ckk62 /+r#   