
    	                     ,   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  \
R                  " \
R                   R"                  \
R                   R$                  5      \
R&                   " S
 S\
R(                  5      5       5       rg)z6Implementation of gcloud dataflow jobs drain command.
    )absolute_import)division)unicode_literals)apis)
exceptions)base)	job_utils)logc                   .    \ rS rSrSr\S 5       rS rSrg)Drain   a  Drains all jobs that match the command line arguments.

Once Drain is triggered, the pipeline will stop accepting new inputs.
The input watermark will be advanced to infinity. Elements already in the
pipeline will continue to be processed. Drained jobs can safely be
cancelled.
c                 .    [         R                  " U SS9  g)z Register flags for this command.+)nargsN)r	   ArgsForJobRefs)parsers    "lib/surface/dataflow/jobs/drain.pyArgs
Drain.Args)   s     V3/    c           	         [         R                  " U5       Hy  n [        R                  R	                  UR
                  UR                  UR                  S9  [        R                  R                  SR                  UR
                  5      5        M{     g! [        R                   ac  n[        R                  R                  SR                  UR
                  UR                  R                  UR                  5      5         SnAM  SnAff = f)zThis is what gets called when the user runs this command.

Args:
  args: all the arguments that were provided to this command invocation.
)
project_id	region_idzStarted draining job [{0}]zFailed to drain job [{0}]: {1} Ensure that you have permission to access the job and that the `--region` flag, {2}, matches the job's region.N)r	   ExtractJobRefsr   Jobsr   jobId	projectIdlocationr
   statusPrintformatr   HttpExceptionpayloadstatus_message)selfargsjob_referrors       r   Run	Drain.Run.   s     ++D1
		MM((&& 	 	( 	

5<<W]]KL 2 %% 	


% fu}};;W=M=M	
 	
	
s   A5BD)ADD N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r)   __static_attributes__r+   r   r   r   r      s      0 0
r   r   N)r0   
__future__r   r   r   googlecloudsdk.api_lib.dataflowr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataflowr	   googlecloudsdk.corer
   ReleaseTracksReleaseTrackBETAGADefaultUniverseOnlyCommandr   r+   r   r   <module>r?      sw     '  ' 0 2 ( 9 # D%%**D,=,=,@,@A$
DLL $
  B$
r   