
                             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  G d	 d
ej                        Zy)zBase class for Hive Job.    )absolute_import)division)unicode_literals)encoding)arg_parsers)base)utilc                   @    e Zd ZdZed        Zed        Zed        Zy)HiveBasez,Common functionality between release tracks.c           	         | j                  d      }|j                  dddddg d	       |j                  d
dd       | j                  dt        j                         dg d       | j                  dt        j                         dd       | j                  dt        j                         dd       | j                  dt
        j                         | j                  ddd       y)z/Performs command line parsing specific to Hive.T)requiredz	--executez-eQUERYqueriesappendz+A Hive query to execute as part of the job.)metavardestactiondefaulthelpz--filez-fz>HCFS URI of file containing Hive script to execute as the job.)r   z--jarsJARzVComma separated list of jar files to be provided to the Hive and MR. May contain UDFs.)typer   r   r   z--paramszPARAM=VALUEz?A list of key value pairs to set variables in the Hive queries.)r   r   r   z--propertieszPROPERTY=VALUEz,A list of key value pairs to configure Hive.z--properties-filez--continue-on-failure
store_truez,Whether to continue if a single query fails.)r   r   N)add_mutually_exclusive_groupadd_argumentr   ArgListArgDictjob_utilPROPERTIES_FILE_HELP_TEXT)parserdrivers     4lib/googlecloudsdk/command_lib/dataproc/jobs/hive.pyArgszHiveBase.Args    s    00$0?F
T:  < $M  O   "/  1   "N	  P
   " ;	  =
 //  1 ;  =    c                 4    | j                   | j                  dS )Njarsfiler%   )argss    r!   GetFilesByTypezHiveBase.GetFilesByTypeG   s     				 r#   c                    | j                  |j                  |d   |d         }|j                  r!| j                  |j                        |_        |j
                  r9t        j                  |j
                  | j                   j                        |_	        t        j                  |j                  |j                        }|r1t        j                  || j                   j                  d      |_        ||_        y)z.Populates the hiveJob member of the given job.r&   r'   )continueOnFailurejarFileUrisqueryFileUri)r   T)
sort_itemsN)HiveJobcontinue_on_failurer   	QueryList	queryListparamsr   DictToAdditionalPropertyMessageScriptVariablesValuescriptVariablesr   BuildJobProperties
propertiesproperties_filePropertiesValuehiveJob)messagesjobfiles_by_typer(   hive_jobjob_propertiess         r!   ConfigureJobzHiveBase.ConfigureJobM   s     22!&)"6*   ,H
 ||#--dll-Ch{{!)!I!I
++x''<<">h 00--/N$DD
(**::tMh CKr#   N)__name__
__module____qualname____doc__staticmethodr"   r)   rA    r#   r!   r   r      s@    4$= $=L  
  r#   r   N)rE   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.callioper   (googlecloudsdk.command_lib.dataproc.jobsr   job_baser	   r   JobBaser   rG   r#   r!   <module>rN      s3      &  ' % / E EFx Fr#   