
    2                         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 SparkR 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)
SparkRBasez!Submit a SparkR job to a cluster.c                    | j                  d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)z:Performs command-line argument parsing specific to SparkR.r_filez"Main .R file to run as the driver.)helpz--filesFILEziComma separated list of files to be placed in the working directory of both the app driver and executors.)typemetavardefaultr   z
--archivesARCHIVEzComma separated list of archives to be extracted into the working directory of each executor. Must be one of the following file formats: .zip, .tar, .tar.gz, or .tgz.job_argsz Arguments to pass to the driver.)nargsr   z--propertieszPROPERTY=VALUEzList of key value pairs to configure SparkR. For a list of available properties, see: https://spark.apache.org/docs/latest/configuration.html#available-properties.)r   r   r   z--properties-filez--driver-log-levelszPACKAGE=LEVELzList of key value pairs to configure driver logging, where key is a package and value is the log4j log level. For example: root=FATAL,com.example=INFON)add_argumentr   ArgListargparse	REMAINDERArgDictjob_utilPROPERTIES_FILE_HELP_TEXT)parsers    7lib/googlecloudsdk/command_lib/dataproc/jobs/spark_r.pyArgszSparkRBase.Args    s    'KL
  ":  ;   "  	   /  1   " 3	  4 //  1   "5	  7    c                 J    | j                   | j                  | j                  dS )Nr   archivesfilesr"   )argss    r   GetFilesByTypezSparkRBase.GetFilesByTypeM   s#     ++MM r    c                 "   | j                  |j                  xs g |d   |d   |d   |      }t        j                  |j                  |j
                        }|r/t        j                  || j                   j                        |_        ||_	        y)z0Populates the sparkRJob member of the given job.r#   r$   r   )r%   archiveUrisfileUrismainRFileUriloggingConfigN)
	SparkRJobr   r   BuildJobProperties
propertiesproperties_filer   DictToMessagePropertiesValue	sparkRJob)messagesjobfiles_by_typelogging_configr%   spark_r_jobjob_propertiess          r   ConfigureJobzSparkRBase.ConfigureJobU   s     $$]] b!*-w'"8,$ % K 00--N '55
(,,<< k  CMr    N)__name__
__module____qualname____doc__staticmethodr   r&   r9    r    r   r   r      s@    )*7 *7X      r    r   )r=   
__future__r   r   r   r   apitools.base.pyr   googlecloudsdk.callioper   (googlecloudsdk.command_lib.dataproc.jobsr   job_baser	   r   JobBaser   r?   r    r   <module>rF      s6    ! &  '  % / E EK !! K r    