
                            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	 rS
 r\R                  \R                  " \R                   R"                  5       " S S\R$                  5      5       5       r\R                  \R                  " \R                   R(                  5       " S S\5      5       5       rg)z3Implementation of gcloud dataflow jobs run command.    )apis)actions)arg_parsers)base)dataflow_util)	job_utils)
propertiesc                    [         R                  " U 5        U R                  SSSS9  U R                  SS[        R                  " SS5      S	S
9  U R                  SS[        R                  " SS5      S9  U R                  SS[        R
                  " 5       [        R                  SS9  U R                  S[        R                  " [        R                  R                  R                  5      SS9  U R                  SS[        R                  " 5       [        R                  SS9  U R                  SS[        R
                  " 5       [        R                  SS9  U R                  SSS[        R                  -   S9  U R!                  5       nUR                  SS[        R"                  S	S 9  UR                  S!S"[        R
                  " 5       [        R                  S#S9  g$)%zfRegister flags for this command.

Args:
  parser: argparse.ArgumentParser to register arguments with.
job_nameJOB_NAMEz%The unique name to assign to the job.)metavarhelpz--gcs-locationzeThe Google Cloud Storage location of the job template to run. (Must be a URL beginning with 'gs://'.)z^gs://.*zMust begin with 'gs://'T)r   typerequiredz--staging-locationzcThe Google Cloud Storage location to stage temporary files. (Must be a URL beginning with 'gs://'.))r   r   z--parameters
PARAMETERSz"The parameters to pass to the job.)r   r   actionr   z--enable-streaming-enginez0Enabling Streaming Engine for the streaming job.)r   r   z--additional-experimentsADDITIONAL_EXPERIMENTSzyAdditional experiments to pass to the job. These experiments are appended to any experiments already set by the template.z--additional-user-labelsADDITIONAL_USER_LABELSzfAdditional user labels to pass to the job. Example: --additional-user-labels='key1=value1,key2=value2'z--region	REGION_IDz*Region ID of the job's regional endpoint. z--updatez+Set this to true for streaming update jobs.)r   r   r   z--transform-name-mappingsTRANSFORM_NAME_MAPPINGSz5Transform name mappings for the streaming update job.N)r   
CommonArgsadd_argumentr   RegexpValidatorArgDictUpdateActionr   StoreBooleanPropertyr	   VALUESdataflowenable_streaming_engineArgListr   DEFAULT_REGION_MESSAGEadd_argument_groupStoreTrueFalseAction)parserstreaming_update_argss      lib/surface/dataflow/jobs/run.py_CommonArgsr'      s    v2  4
 	6&&{'BD   	6&&{'BD	  E 	 %%/  1 	!))



$
$
<
<>=	  ? 	 & %%G  I 	 & %%A  	 	9001  3 !335$$8--	 %  $$!' %%B %     c           	         [         R                  " S0 S[        R                  R                  R
                  R                  SS9_S[        R                  " U 5      _SU R                  _SU R                  _SU R                  _SU R                  _S	U R                  _S
U R                  _SU R                  _SU R                   _SU R"                  _SU R$                  _S[        R                  R&                  R(                  R+                  5       _SU R,                  _SU R.                  _SU R0                  _SU R2                  _S[        R                  R&                  R4                  R+                  5       _SU R6                  _SU R8                  _SU R:                  _SU R<                  _6nU R6                  (       a  [         R>                  RA                  U5      $ [         R>                  RC                  U5      $ )zyRuns the command.

Args:
  args: The arguments that were provided to this command invocation.

Returns:
  A Job message.

project_idT)r   	region_idr   gcs_locationzonemax_workersnum_workersnetwork
subnetworkworker_machine_typestaging_locationkms_key_namedisable_public_ips
parametersservice_account_emailworker_regionworker_zoner   streaming_updatetransform_name_mappingsadditional_experimentsadditional_user_labels )"r   TemplateArgumentsr	   r   coreprojectGetr   	GetRegionr   r,   r-   r.   r/   r0   r1   r2   r3   dataflow_kms_keyr   r5   GetBoolr6   r7   r8   r9   r   updater;   r<   r=   	TemplatesLaunchDynamicTemplateCreate)args	argumentss     r&   
_CommonRunrL   n   s    $$ ""''//33T3B''- }} $$	
 99 "" "" ll  22 ,, (( $**33FFNNP  !66  &&!" ""#$ )//88PPXXZ%& {{'( #::)* "88+, "88-)0 
[[>>//	::>>  ++r(   c                   .    \ rS rSrSr\S 5       rS rSrg)Run   #Runs a job from the specified path.c                     [        U 5        g Nr'   r$   s    r&   ArgsRun.Args   
    r(   c                     [        U5      $ rR   rL   selfrJ   s     r&   rN   Run.Run       dr(   r>   N	__name__
__module____qualname____firstlineno____doc__staticmethodrU   rN   __static_attributes__r>   r(   r&   rN   rN           , r(   rN   c                   .    \ rS rSrSr\S 5       rS rSrg)RunBeta   rP   c                     [        U 5        g rR   rS   rT   s    r&   rU   RunBeta.Args   rW   r(   c                     [        U5      $ rR   rY   rZ   s     r&   rN   RunBeta.Run   r]   r(   r>   Nr^   r>   r(   r&   rh   rh      rf   r(   rh   N)rc   googlecloudsdk.api_lib.dataflowr   googlecloudsdk.callioper   r   r   #googlecloudsdk.command_lib.dataflowr   r   googlecloudsdk.corer	   r'   rL   UniverseCompatibleReleaseTracksReleaseTrackGACommandrN   BETArh   r>   r(   r&   <module>rx      s    : 1 + / ( = 9 *Pf$,N D%%(()$,,  *  D%%**+c  , r(   