Module Contents

class airflow.contrib.operators.spark_submit_operator.SparkSubmitOperator(application='', conf=None, conn_id='spark_default', files=None, py_files=None, archives=None, driver_class_path=None, jars=None, java_class=None, packages=None, exclude_packages=None, repositories=None, total_executor_cores=None, executor_cores=None, executor_memory=None, driver_memory=None, keytab=None, principal=None, name='airflow-spark', num_executors=None, application_args=None, env_vars=None, verbose=False, spark_binary='spark-submit', *args, **kwargs)[source]


This hook is a wrapper around the spark-submit binary to kick off a spark-submit job. It requires that the “spark-submit” binary is in the PATH or the spark-home is set in the extra on the connection.

  • application (str) – The application that submitted as a job, either jar or py file. (templated)

  • conf (dict) – Arbitrary Spark configuration properties (templated)

  • conn_id (str) – The connection id as configured in Airflow administration. When an invalid connection_id is supplied, it will default to yarn.

  • files (str) – Upload additional files to the executor running the job, separated by a comma. Files will be placed in the working directory of each executor. For example, serialized objects. (templated)

  • py_files (str) – Additional python files used by the job, can be .zip, .egg or .py. (templated)

  • jars (str) – Submit additional jars to upload and place them in executor classpath. (templated)

  • driver_class_path (str) – Additional, driver-specific, classpath settings. (templated)

  • java_class (str) – the main class of the Java application

  • packages (str) – Comma-separated list of maven coordinates of jars to include on the driver and executor classpaths. (templated)

  • exclude_packages (str) – Comma-separated list of maven coordinates of jars to exclude while resolving the dependencies provided in ‘packages’ (templated)

  • repositories (str) – Comma-separated list of additional remote repositories to search for the maven coordinates given with ‘packages’

  • total_executor_cores (int) – (Standalone & Mesos only) Total cores for all executors (Default: all the available cores on the worker)

  • executor_cores (int) – (Standalone & YARN only) Number of cores per executor (Default: 2)

  • executor_memory (str) – Memory per executor (e.g. 1000M, 2G) (Default: 1G)

  • driver_memory (str) – Memory allocated to the driver (e.g. 1000M, 2G) (Default: 1G)

  • keytab (str) – Full path to the file that contains the keytab (templated)

  • principal (str) – The name of the kerberos principal used for keytab (templated)

  • name (str) – Name of the job (default airflow-spark). (templated)

  • num_executors (int) – Number of executors to launch

  • application_args (list) – Arguments for the application being submitted (templated)

  • env_vars (dict) – Environment variables for spark-submit. It supports yarn and k8s mode too. (templated)

  • verbose (bool) – Whether to pass the verbose flag to spark-submit process for debugging

  • spark_binary (string) – The command to use for spark submit. Some distros may use spark2-submit.

template_fields = ['_application', '_conf', '_files', '_py_files', '_jars', '_driver_class_path', '_packages', '_exclude_packages', '_keytab', '_principal', '_name', '_application_args', '_env_vars'][source]
execute(self, context)[source]

Call the SparkSubmitHook to run the provided spark job