
    p                         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 the Presto 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)
PrestoBasez!Submit a Presto job to a cluster.c           	         | j                  d      }|j                  dddddg d	       |j                  d
dd       | j                  dt        j                         dd       | j                  dt        j
                         | j                  dt        j                         dd       | j                  ddd       | j                  dd       | j                  dt        j                         dd       y) zAParses command line arguments specific to submitting Presto jobs.T)requiredz	--executez-eQUERYqueriesappendzA Presto query to execute.)metavardestactiondefaulthelpz--filez-fz9HCFS URI of file containing the Presto script to execute.)r   z--propertieszPARAM=VALUEz;A list of key value pairs to set Presto session properties.)typer   r   z--properties-filez--driver-log-levelszPACKAGE=LEVELzpA list of package-to-log4j log level pairs to configure driver logging. For example: root=FATAL,com.example=INFOz--continue-on-failure
store_truez%Whether to continue if a query fails.)r   r   z--query-output-formatz[The query output display format. See the Presto documentation for supported output formats.z--client-tags
CLIENT_TAGz5A list of Presto client tags to attach to this query.N)add_mutually_exclusive_groupadd_argumentr   ArgDictjob_utilPROPERTIES_FILE_HELP_TEXTArgList)parserdrivers     6lib/googlecloudsdk/command_lib/dataproc/jobs/presto.pyArgszPrestoBase.Args   s>    00$0?F
)  + H  J   "J	  L
 //  1   "B	  D 4  6 .  0   "D	  F    c                     d| j                   iS )Nfile)r%   )argss    r!   GetFilesByTypezPrestoBase.GetFilesByTypeK   s    DIIr#   c                    | j                  |j                  |d   |      }|j                  r!| j                  |j                        |_        |j
                  r|j
                  |_        |j                  r|j                  |_        t        j                  |j                  |j                        }|r1t        j                  || j                   j                  d      |_        ||_        y)z0Populates the prestoJob member of the given job.r%   )continueOnFailurequeryFileUriloggingConfig)r   T)
sort_itemsN)	PrestoJobcontinue_on_failurer   	QueryList	queryListquery_output_formatoutputFormatclient_tags
clientTagsr   BuildJobProperties
propertiesproperties_filer   DictToAdditionalPropertyMessagePropertiesValue	prestoJob)messagesjobfiles_by_typelogging_configr&   
presto_jobjob_propertiess          r!   ConfigureJobzPrestoBase.ConfigureJobO   s     ##22"6*$ $ &J
 ||%///Ej $ 8 8j"..j00--/N&FF
(,,<<Oj CMr#   N)__name__
__module____qualname____doc__staticmethodr"   r'   rA    r#   r!   r   r      sB    ))F )FV    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J!! Jr#   