
    F                         d Z ddlmZ ddlmZ ddlmZ ddl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 Hadoop Job.    )absolute_import)division)unicode_literalsN)encoding)arg_parsers)base)utilc                   @    e Zd ZdZed        Zed        Zed        Zy)
HadoopBasez,Common functionality between release tracks.c                    | j                  dt        j                         dg d       | j                  dt        j                         dg d       | j                  dt        j                         d	g d
       | j                  dt        j                  d       | j                  dt        j
                         dd       | j                  dt        j                         | j                  dt        j
                         dd       y)zAParses command-line arguments specific to submitting Hadoop jobs.z--jarsJARzQComma separated list of jar files to be provided to the MR and driver classpaths.)typemetavardefaulthelpz--filesFILEzComma separated list of file paths to be provided to the job. A file path can either be a path to a local file or a path to a file already in a Cloud Storage bucket.z
--archivesARCHIVEzComma separated list of archives to be provided to the job. must be one of the following file formats: .zip, .tar, .tar.gz, or .tgz.job_argsz$The arguments to pass to the driver.)nargsr   z--propertieszPROPERTY=VALUEz.A list of key value pairs to configure Hadoop.)r   r   r   z--properties-file)r   z--driver-log-levelszPACKAGE=LEVELzpA list of package to log4j log level pairs to configure driver logging. For example: root=FATAL,com.example=INFON)add_argumentr   ArgListargparse	REMAINDERArgDictjob_utilPROPERTIES_FILE_HELP_TEXT)parsers    6lib/googlecloudsdk/command_lib/dataproc/jobs/hadoop.pyArgszHadoopBase.Args"   s,      "#  %   "<  =   "     3  5   " =	  ?
 //  1   "B	  D    c                 `    | j                   | j                  | j                  | j                  dS )z=Returns a dict of files by their type (jars, archives, etc.).main_jarjarsarchivesfilesr"   )argss    r   GetFilesByTypezHadoopBase.GetFilesByTypeO   s*     MM		MM	 r    c           	      D   | j                  |j                  xs g |d   |d   |d   |j                  |d   |      }t        j                  |j
                  |j                        }|r1t        j                  || j                   j                  d      |_        ||_
        y)	z0Populates the hadoopJob member of the given job.r%   r&   r$   r#   )r'   archiveUrisfileUrisjarFileUris	mainClassmainJarFileUriloggingConfigT)
sort_itemsN)	HadoopJobr   
main_classr   BuildJobProperties
propertiesproperties_filer   DictToAdditionalPropertyMessagePropertiesValue	hadoopJob)messagesjobfiles_by_typelogging_configr'   
hadoop_jobjob_propertiess          r   ConfigureJobzHadoopBase.ConfigureJobX   s     ##]] b!*-w'!&)//$Z0$ $ &J 00--/N&FF
(,,<<Oj CMr    N)__name__
__module____qualname____doc__staticmethodr   r(   r?    r    r   r   r      sB    4*D *DX    r    r   )rC   
__future__r   r   r   r   apitools.base.pyr   googlecloudsdk.callioper   (googlecloudsdk.command_lib.dataproc.jobsr   job_baser	   r   JobBaser   rE   r    r   <module>rL      s6     ! &  '  % / E EL!! Lr    