2015-10-22 02:36:16 +03:00
|
|
|
API Reference
|
|
|
|
=============
|
2014-10-13 09:05:34 +04:00
|
|
|
|
2018-06-29 15:15:16 +03:00
|
|
|
.. _api-reference-operators:
|
|
|
|
|
2015-02-02 22:12:04 +03:00
|
|
|
Operators
|
|
|
|
---------
|
2015-06-29 01:57:13 +03:00
|
|
|
Operators allow for generation of certain types of tasks that become nodes in
|
2018-02-20 23:18:46 +03:00
|
|
|
the DAG when instantiated. All operators derive from ``BaseOperator`` and
|
|
|
|
inherit many attributes and methods that way. Refer to the BaseOperator_
|
2015-06-29 01:57:13 +03:00
|
|
|
documentation for more details.
|
2015-02-02 22:12:04 +03:00
|
|
|
|
2015-04-05 09:27:00 +03:00
|
|
|
There are 3 main types of operators:
|
|
|
|
|
2015-06-29 01:57:13 +03:00
|
|
|
- Operators that performs an **action**, or tell another system to
|
2015-04-05 09:27:00 +03:00
|
|
|
perform an action
|
2015-06-29 01:57:13 +03:00
|
|
|
- **Transfer** operators move data from one system to another
|
|
|
|
- **Sensors** are a certain type of operator that will keep running until a
|
|
|
|
certain criterion is met. Examples include a specific file landing in HDFS or
|
2015-04-21 17:41:17 +03:00
|
|
|
S3, a partition appearing in Hive, or a specific time of the day. Sensors
|
2015-04-05 09:27:00 +03:00
|
|
|
are derived from ``BaseSensorOperator`` and run a poke
|
|
|
|
method at a specified ``poke_interval`` until it returns ``True``.
|
|
|
|
|
2015-07-16 21:01:16 +03:00
|
|
|
BaseOperator
|
|
|
|
''''''''''''
|
|
|
|
All operators are derived from ``BaseOperator`` and acquire much
|
|
|
|
functionality through inheritance. Since this is the core of the engine,
|
|
|
|
it's worth taking the time to understand the parameters of ``BaseOperator``
|
|
|
|
to understand the primitive features that can be leveraged in your
|
|
|
|
DAGs.
|
|
|
|
|
2015-08-06 22:07:03 +03:00
|
|
|
|
|
|
|
.. autoclass:: airflow.models.BaseOperator
|
2015-07-16 21:01:16 +03:00
|
|
|
|
|
|
|
|
2015-10-06 02:30:22 +03:00
|
|
|
BaseSensorOperator
|
|
|
|
'''''''''''''''''''
|
|
|
|
All sensors are derived from ``BaseSensorOperator``. All sensors inherit
|
|
|
|
the ``timeout`` and ``poke_interval`` on top of the ``BaseOperator``
|
|
|
|
attributes.
|
|
|
|
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.sensors.base_sensor_operator.BaseSensorOperator
|
2015-10-06 02:30:22 +03:00
|
|
|
|
|
|
|
|
2018-02-20 23:18:46 +03:00
|
|
|
Core Operators
|
|
|
|
''''''''''''''
|
|
|
|
|
|
|
|
Operators
|
|
|
|
^^^^^^^^^
|
2015-07-16 21:01:16 +03:00
|
|
|
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.bash_operator.BashOperator
|
|
|
|
.. autoclass:: airflow.operators.python_operator.BranchPythonOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.check_operator.CheckOperator
|
2016-05-04 08:13:35 +03:00
|
|
|
.. autoclass:: airflow.operators.docker_operator.DockerOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.dummy_operator.DummyOperator
|
2018-04-17 12:12:41 +03:00
|
|
|
.. autoclass:: airflow.operators.druid_check_operator.DruidCheckOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.email_operator.EmailOperator
|
|
|
|
.. autoclass:: airflow.operators.generic_transfer.GenericTransfer
|
|
|
|
.. autoclass:: airflow.operators.hive_to_druid.HiveToDruidTransfer
|
|
|
|
.. autoclass:: airflow.operators.hive_to_mysql.HiveToMySqlTransfer
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.hive_to_samba_operator.Hive2SambaOperator
|
|
|
|
.. autoclass:: airflow.operators.hive_operator.HiveOperator
|
|
|
|
.. autoclass:: airflow.operators.hive_stats_operator.HiveStatsCollectionOperator
|
|
|
|
.. autoclass:: airflow.operators.check_operator.IntervalCheckOperator
|
|
|
|
.. autoclass:: airflow.operators.jdbc_operator.JdbcOperator
|
|
|
|
.. autoclass:: airflow.operators.latest_only_operator.LatestOnlyOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.mssql_operator.MsSqlOperator
|
|
|
|
.. autoclass:: airflow.operators.mssql_to_hive.MsSqlToHiveTransfer
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.mysql_operator.MySqlOperator
|
|
|
|
.. autoclass:: airflow.operators.mysql_to_hive.MySqlToHiveTransfer
|
|
|
|
.. autoclass:: airflow.operators.oracle_operator.OracleOperator
|
|
|
|
.. autoclass:: airflow.operators.pig_operator.PigOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.postgres_operator.PostgresOperator
|
|
|
|
.. autoclass:: airflow.operators.presto_check_operator.PrestoCheckOperator
|
|
|
|
.. autoclass:: airflow.operators.presto_check_operator.PrestoIntervalCheckOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.presto_to_mysql.PrestoToMySqlTransfer
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.presto_check_operator.PrestoValueCheckOperator
|
|
|
|
.. autoclass:: airflow.operators.python_operator.PythonOperator
|
|
|
|
.. autoclass:: airflow.operators.python_operator.PythonVirtualenvOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.s3_file_transform_operator.S3FileTransformOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.s3_to_hive_operator.S3ToHiveTransfer
|
2018-04-10 10:13:04 +03:00
|
|
|
.. autoclass:: airflow.operators.s3_to_redshift_operator.S3ToRedshiftTransfer
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.python_operator.ShortCircuitOperator
|
|
|
|
.. autoclass:: airflow.operators.http_operator.SimpleHttpOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.slack_operator.SlackAPIOperator
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.operators.slack_operator.SlackAPIPostOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.sqlite_operator.SqliteOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.operators.subdag_operator.SubDagOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.operators.dagrun_operator.TriggerDagRunOperator
|
|
|
|
.. autoclass:: airflow.operators.check_operator.ValueCheckOperator
|
|
|
|
.. autoclass:: airflow.operators.redshift_to_s3_operator.RedshiftToS3Transfer
|
2018-01-19 20:59:08 +03:00
|
|
|
|
2018-02-20 23:18:46 +03:00
|
|
|
Sensors
|
|
|
|
^^^^^^^
|
2018-01-19 20:59:08 +03:00
|
|
|
.. autoclass:: airflow.sensors.external_task_sensor.ExternalTaskSensor
|
|
|
|
.. autoclass:: airflow.sensors.hdfs_sensor.HdfsSensor
|
|
|
|
.. autoclass:: airflow.sensors.hive_partition_sensor.HivePartitionSensor
|
|
|
|
.. autoclass:: airflow.sensors.http_sensor.HttpSensor
|
|
|
|
.. autoclass:: airflow.sensors.metastore_partition_sensor.MetastorePartitionSensor
|
|
|
|
.. autoclass:: airflow.sensors.named_hive_partition_sensor.NamedHivePartitionSensor
|
|
|
|
.. autoclass:: airflow.sensors.s3_key_sensor.S3KeySensor
|
|
|
|
.. autoclass:: airflow.sensors.s3_prefix_sensor.S3PrefixSensor
|
|
|
|
.. autoclass:: airflow.sensors.sql_sensor.SqlSensor
|
|
|
|
.. autoclass:: airflow.sensors.time_sensor.TimeSensor
|
|
|
|
.. autoclass:: airflow.sensors.time_delta_sensor.TimeDeltaSensor
|
|
|
|
.. autoclass:: airflow.sensors.web_hdfs_sensor.WebHdfsSensor
|
2015-09-19 17:53:45 +03:00
|
|
|
|
2015-10-15 00:59:14 +03:00
|
|
|
Community-contributed Operators
|
2015-09-19 17:53:45 +03:00
|
|
|
'''''''''''''''''''''''''''''''
|
|
|
|
|
2018-02-20 23:18:46 +03:00
|
|
|
Operators
|
|
|
|
^^^^^^^^^
|
2018-05-08 21:12:52 +03:00
|
|
|
.. Alphabetize this list
|
2018-02-20 23:18:46 +03:00
|
|
|
|
|
|
|
.. autoclass:: airflow.contrib.operators.awsbatch_operator.AWSBatchOperator
|
2018-02-05 12:48:00 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_check_operator.BigQueryCheckOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_check_operator.BigQueryValueCheckOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_check_operator.BigQueryIntervalCheckOperator
|
2018-01-03 23:48:01 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_get_data.BigQueryGetDataOperator
|
2018-02-09 12:04:18 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_operator.BigQueryCreateEmptyTableOperator
|
2018-02-10 19:24:11 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_operator.BigQueryCreateExternalTableOperator
|
2018-07-17 15:56:05 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_operator.BigQueryDeleteDatasetOperator
|
2016-06-29 23:39:15 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_operator.BigQueryOperator
|
2018-02-05 12:48:00 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_table_delete_operator.BigQueryTableDeleteOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_to_bigquery.BigQueryToBigQueryOperator
|
2016-06-29 23:39:15 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.bigquery_to_gcs.BigQueryToCloudStorageOperator
|
2018-05-18 04:01:41 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.cassandra_to_gcs.CassandraToGoogleCloudStorageOperator
|
2017-04-06 18:30:01 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.databricks_operator.DatabricksSubmitRunOperator
|
2018-02-05 12:48:00 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.dataflow_operator.DataFlowJavaOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataflow_operator.DataflowTemplateOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataflow_operator.DataFlowPythonOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataprocClusterCreateOperator
|
2018-05-14 18:38:28 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataprocClusterScaleOperator
|
2018-02-05 12:48:00 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataprocClusterDeleteOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataProcPigOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataProcHiveOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataProcSparkSqlOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataProcSparkOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataProcHadoopOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataProcPySparkOperator
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataprocWorkflowTemplateBaseOperator
|
2018-02-05 12:48:00 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataprocWorkflowTemplateInstantiateOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.dataproc_operator.DataprocWorkflowTemplateInstantiateInlineOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.datastore_export_operator.DatastoreExportOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.datastore_import_operator.DatastoreImportOperator
|
2018-03-31 21:12:33 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.discord_webhook_operator.DiscordWebhookOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.druid_operator.DruidOperator
|
2016-11-23 21:49:57 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.ecs_operator.ECSOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.emr_add_steps_operator.EmrAddStepsOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.emr_create_job_flow_operator.EmrCreateJobFlowOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.emr_terminate_job_flow_operator.EmrTerminateJobFlowOperator
|
2018-02-05 12:48:00 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.file_to_gcs.FileToGoogleCloudStorageOperator
|
2017-04-05 10:56:23 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.file_to_wasb.FileToWasbOperator
|
2018-06-15 22:44:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.gcp_container_operator.GKEClusterCreateOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.gcp_container_operator.GKEClusterDeleteOperator
|
2016-06-29 23:39:15 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.gcs_download_operator.GoogleCloudStorageDownloadOperator
|
2018-02-05 12:48:00 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.gcs_list_operator.GoogleCloudStorageListOperator
|
2018-02-19 17:21:04 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.gcs_operator.GoogleCloudStorageCreateBucketOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.gcs_to_bq.GoogleCloudStorageToBigQueryOperator
|
2018-01-03 23:48:01 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.gcs_to_gcs.GoogleCloudStorageToGoogleCloudStorageOperator
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.gcs_to_s3.GoogleCloudStorageToS3Operator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.hipchat_operator.HipChatAPIOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.hipchat_operator.HipChatAPISendRoomNotificationOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.hive_to_dynamodb.HiveToDynamoDBTransferOperator
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.jenkins_job_trigger_operator.JenkinsJobTriggerOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.jira_operator.JiraOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.kubernetes_pod_operator.KubernetesPodOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.mlengine_operator.MLEngineBatchPredictionOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.mlengine_operator.MLEngineModelOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.mlengine_operator.MLEngineVersionOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.mlengine_operator.MLEngineTrainingOperator
|
2018-06-06 01:30:02 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.mongo_to_s3.MongoToS3Operator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.mysql_to_gcs.MySqlToGoogleCloudStorageOperator
|
2018-07-20 23:46:59 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.oracle_to_azure_data_lake_transfer.OracleToAzureDataLakeTransfer
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.postgres_to_gcs_operator.PostgresToGoogleCloudStorageOperator
|
2017-12-19 01:53:30 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.pubsub_operator.PubSubTopicCreateOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.pubsub_operator.PubSubTopicDeleteOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.pubsub_operator.PubSubSubscriptionCreateOperator
|
2017-12-21 00:25:12 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.pubsub_operator.PubSubSubscriptionDeleteOperator
|
2017-12-19 01:53:30 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.pubsub_operator.PubSubPublishOperator
|
2018-05-15 12:21:35 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.qubole_check_operator.QuboleCheckOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.qubole_check_operator.QuboleValueCheckOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.qubole_operator.QuboleOperator
|
2018-04-10 10:07:35 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.s3_list_operator.S3ListOperator
|
2018-04-13 10:32:22 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.s3_to_gcs_operator.S3ToGoogleCloudStorageOperator
|
2018-05-15 09:54:04 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.segment_track_event_operator.SegmentTrackEventOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.sftp_operator.SFTPOperator
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.slack_webhook_operator.SlackWebhookOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.snowflake_operator.SnowflakeOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.spark_jdbc_operator.SparkJDBCOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.spark_sql_operator.SparkSqlOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.spark_submit_operator.SparkSubmitOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.sqoop_operator.SqoopOperator
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.ssh_operator.SSHOperator
|
|
|
|
.. autoclass:: airflow.contrib.operators.vertica_operator.VerticaOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.vertica_to_hive.VerticaToHiveTransfer
|
2018-05-08 21:12:52 +03:00
|
|
|
.. autoclass:: airflow.contrib.operators.winrm_operator.WinRMOperator
|
2018-02-20 23:18:46 +03:00
|
|
|
|
|
|
|
Sensors
|
|
|
|
^^^^^^^
|
2018-01-19 20:59:08 +03:00
|
|
|
|
|
|
|
.. autoclass:: airflow.contrib.sensors.aws_redshift_cluster_sensor.AwsRedshiftClusterSensor
|
2017-12-29 21:21:01 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.bash_sensor.BashSensor
|
2018-01-19 20:59:08 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.bigquery_sensor.BigQueryTableSensor
|
2018-06-20 21:36:32 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.cassandra_record_sensor.CassandraRecordSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.cassandra_table_sensor.CassandraTableSensor
|
2018-01-19 20:59:08 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.datadog_sensor.DatadogSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.emr_base_sensor.EmrBaseSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.emr_job_flow_sensor.EmrJobFlowSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.emr_step_sensor.EmrStepSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.file_sensor.FileSensor
|
2018-03-20 00:55:51 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.ftp_sensor.FTPSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.ftp_sensor.FTPSSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.gcs_sensor.GoogleCloudStorageObjectSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.gcs_sensor.GoogleCloudStorageObjectUpdatedSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.gcs_sensor.GoogleCloudStoragePrefixSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.hdfs_sensor.HdfsSensorFolder
|
|
|
|
.. autoclass:: airflow.contrib.sensors.hdfs_sensor.HdfsSensorRegex
|
2018-01-19 20:59:08 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.jira_sensor.JiraSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.pubsub_sensor.PubSubPullSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.qubole_sensor.QuboleSensor
|
|
|
|
.. autoclass:: airflow.contrib.sensors.redis_key_sensor.RedisKeySensor
|
2018-04-12 10:15:10 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.sftp_sensor.SFTPSensor
|
2018-01-19 20:59:08 +03:00
|
|
|
.. autoclass:: airflow.contrib.sensors.wasb_sensor.WasbBlobSensor
|
2016-05-04 08:13:35 +03:00
|
|
|
|
2015-09-17 02:20:04 +03:00
|
|
|
.. _macros:
|
|
|
|
|
2015-02-02 22:12:04 +03:00
|
|
|
Macros
|
|
|
|
---------
|
2015-02-03 09:09:49 +03:00
|
|
|
Here's a list of variables and macros that can be used in templates
|
|
|
|
|
|
|
|
|
|
|
|
Default Variables
|
|
|
|
'''''''''''''''''
|
|
|
|
The Airflow engine passes a few variables by default that are accessible
|
|
|
|
in all templates
|
|
|
|
|
|
|
|
================================= ====================================
|
|
|
|
Variable Description
|
|
|
|
================================= ====================================
|
|
|
|
``{{ ds }}`` the execution date as ``YYYY-MM-DD``
|
2016-02-11 17:31:01 +03:00
|
|
|
``{{ ds_nodash }}`` the execution date as ``YYYYMMDD``
|
2018-05-25 11:13:49 +03:00
|
|
|
``{{ prev_ds }}`` the previous execution date as ``YYYY-MM-DD``.
|
|
|
|
if ``{{ ds }}`` is ``2016-01-08`` and ``schedule_interval`` is ``@weekly``,
|
|
|
|
``{{ prev_ds }}`` will be ``2016-01-01``.
|
|
|
|
``{{ next_ds }}`` the next execution date as ``YYYY-MM-DD``.
|
|
|
|
if ``{{ ds }}`` is ``2016-01-01`` and ``schedule_interval`` is ``@weekly``,
|
|
|
|
``{{ prev_ds }}`` will be ``2016-01-08``.
|
2016-02-11 17:31:01 +03:00
|
|
|
``{{ yesterday_ds }}`` yesterday's date as ``YYYY-MM-DD``
|
|
|
|
``{{ yesterday_ds_nodash }}`` yesterday's date as ``YYYYMMDD``
|
|
|
|
``{{ tomorrow_ds }}`` tomorrow's date as ``YYYY-MM-DD``
|
|
|
|
``{{ tomorrow_ds_nodash }}`` tomorrow's date as ``YYYYMMDD``
|
2015-12-01 19:30:02 +03:00
|
|
|
``{{ ts }}`` same as ``execution_date.isoformat()``
|
|
|
|
``{{ ts_nodash }}`` same as ``ts`` without ``-`` and ``:``
|
2015-10-15 00:59:14 +03:00
|
|
|
``{{ execution_date }}`` the execution_date, (datetime.datetime)
|
2017-01-29 14:41:36 +03:00
|
|
|
``{{ prev_execution_date }}`` the previous execution date (if available) (datetime.datetime)
|
|
|
|
``{{ next_execution_date }}`` the next execution date (datetime.datetime)
|
2015-02-03 09:09:49 +03:00
|
|
|
``{{ dag }}`` the DAG object
|
|
|
|
``{{ task }}`` the Task object
|
2015-10-15 00:59:14 +03:00
|
|
|
``{{ macros }}`` a reference to the macros package, described below
|
2015-02-03 09:09:49 +03:00
|
|
|
``{{ task_instance }}`` the task_instance object
|
|
|
|
``{{ end_date }}`` same as ``{{ ds }}``
|
2015-10-15 00:59:14 +03:00
|
|
|
``{{ latest_date }}`` same as ``{{ ds }}``
|
2015-02-03 09:09:49 +03:00
|
|
|
``{{ ti }}`` same as ``{{ task_instance }}``
|
[AIRFLOW-2526] dag_run.conf can override params
Make sure you have checked _all_ steps below.
### JIRA
- [x] My PR addresses the following [Airflow JIRA]
(https://issues.apache.org/jira/browse/AIRFLOW/)
issues and references them in the PR title. For
example, "\[AIRFLOW-XXX\] My Airflow PR"
-
https://issues.apache.org/jira/browse/AIRFLOW-2526
- In case you are fixing a typo in the
documentation you can prepend your commit with
\[AIRFLOW-XXX\], code changes always need a JIRA
issue.
### Description
- [x] Here are some details about my PR, including
screenshots of any UI changes:
params can be overridden by the dictionary passed
through `airflow backfill -c`
```
templated_command = """
echo "text = {{ params.text }}"
"""
bash_operator = BashOperator(
task_id='bash_task',
bash_command=templated_command,
dag=dag,
params= {
"text" : "normal processing"
})
```
In daily processing it prints:
```
normal processing
```
In backfill processing `airflow trigger_dag -c
"{"text": "override success"}"`, it prints
```
override success
```
### Tests
- [ ] My PR adds the following unit tests __OR__
does not need testing for this extremely good
reason:
### Commits
- [x] My commits all reference JIRA issues in
their subject lines, and I have squashed multiple
commits if they address the same issue. In
addition, my commits follow the guidelines from
"[How to write a good git commit
message](http://chris.beams.io/posts/git-
commit/)":
1. Subject is separated from body by a blank line
2. Subject is limited to 50 characters
3. Subject does not end with a period
4. Subject uses the imperative mood ("add", not
"adding")
5. Body wraps at 72 characters
6. Body explains "what" and "why", not "how"
### Documentation
- [x] In case of new functionality, my PR adds
documentation that describes how to use it.
- When adding new operators/hooks/sensors, the
autoclass documentation generation needs to be
added.
### Code Quality
- [x] Passes `git diff upstream/master -u --
"*.py" | flake8 --diff`
Closes #3422 from milton0825/params-overridden-
through-cli
2018-06-01 21:22:10 +03:00
|
|
|
``{{ params }}`` a reference to the user-defined params dictionary which can be overridden by
|
|
|
|
the dictionary passed through ``trigger_dag -c`` if you enabled
|
|
|
|
``dag_run_conf_overrides_params` in ``airflow.cfg``
|
2016-06-21 20:29:19 +03:00
|
|
|
``{{ var.value.my_var }}`` global defined variables represented as a dictionary
|
|
|
|
``{{ var.json.my_var.path }}`` global defined variables represented as a dictionary
|
|
|
|
with deserialized JSON object, append the path to the
|
|
|
|
key within the JSON object
|
2015-10-15 00:59:14 +03:00
|
|
|
``{{ task_instance_key_str }}`` a unique, human-readable key to the task instance
|
2015-02-03 09:09:49 +03:00
|
|
|
formatted ``{dag_id}_{task_id}_{ds}``
|
2017-06-18 11:26:57 +03:00
|
|
|
``{{ conf }}`` the full configuration object located at
|
2015-07-23 06:45:29 +03:00
|
|
|
``airflow.configuration.conf`` which
|
|
|
|
represents the content of your
|
|
|
|
``airflow.cfg``
|
2017-06-18 11:26:57 +03:00
|
|
|
``{{ run_id }}`` the ``run_id`` of the current DAG run
|
|
|
|
``{{ dag_run }}`` a reference to the DagRun object
|
|
|
|
``{{ test_mode }}`` whether the task instance was called using
|
2015-11-21 20:39:23 +03:00
|
|
|
the CLI's test subcommand
|
2015-02-03 09:09:49 +03:00
|
|
|
================================= ====================================
|
|
|
|
|
2015-06-29 01:57:13 +03:00
|
|
|
Note that you can access the object's attributes and methods with simple
|
2015-04-21 17:41:17 +03:00
|
|
|
dot notation. Here are some examples of what is possible:
|
2015-02-03 09:09:49 +03:00
|
|
|
``{{ task.owner }}``, ``{{ task.task_id }}``, ``{{ ti.hostname }}``, ...
|
2015-06-29 01:57:13 +03:00
|
|
|
Refer to the models documentation for more information on the objects'
|
2015-02-03 09:09:49 +03:00
|
|
|
attributes and methods.
|
|
|
|
|
2016-06-21 20:29:19 +03:00
|
|
|
The ``var`` template variable allows you to access variables defined in Airflow's
|
|
|
|
UI. You can access them as either plain-text or JSON. If you use JSON, you are
|
|
|
|
also able to walk nested structures, such as dictionaries like:
|
|
|
|
``{{ var.json.my_dict_var.key1 }}``
|
|
|
|
|
2015-02-03 09:09:49 +03:00
|
|
|
Macros
|
|
|
|
''''''
|
2016-04-03 16:54:01 +03:00
|
|
|
Macros are a way to expose objects to your templates and live under the
|
2015-11-19 19:40:16 +03:00
|
|
|
``macros`` namespace in your templates.
|
|
|
|
|
|
|
|
A few commonly used libraries and methods are made available.
|
|
|
|
|
2015-11-30 19:25:55 +03:00
|
|
|
|
2015-11-19 19:40:16 +03:00
|
|
|
================================= ====================================
|
|
|
|
Variable Description
|
|
|
|
================================= ====================================
|
2015-11-30 19:25:55 +03:00
|
|
|
``macros.datetime`` The standard lib's ``datetime.datetime``
|
|
|
|
``macros.timedelta`` The standard lib's ``datetime.timedelta``
|
|
|
|
``macros.dateutil`` A reference to the ``dateutil`` package
|
2015-11-19 19:40:16 +03:00
|
|
|
``macros.time`` The standard lib's ``time``
|
|
|
|
``macros.uuid`` The standard lib's ``uuid``
|
|
|
|
``macros.random`` The standard lib's ``random``
|
|
|
|
================================= ====================================
|
|
|
|
|
2015-11-30 19:25:55 +03:00
|
|
|
|
2015-11-19 19:40:16 +03:00
|
|
|
Some airflow specific macros are also defined:
|
2015-02-03 09:09:49 +03:00
|
|
|
|
|
|
|
.. automodule:: airflow.macros
|
2015-04-21 17:41:17 +03:00
|
|
|
:show-inheritance:
|
2015-02-03 09:09:49 +03:00
|
|
|
:members:
|
2015-02-02 22:12:04 +03:00
|
|
|
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autofunction:: airflow.macros.hive.closest_ds_partition
|
|
|
|
.. autofunction:: airflow.macros.hive.max_partition
|
2015-02-02 22:12:04 +03:00
|
|
|
|
|
|
|
.. _models_ref:
|
|
|
|
|
2014-10-13 09:05:34 +04:00
|
|
|
Models
|
|
|
|
------
|
2015-02-02 22:12:04 +03:00
|
|
|
|
2015-10-15 00:59:14 +03:00
|
|
|
Models are built on top of the SQLAlchemy ORM Base class, and instances are
|
2014-10-13 09:05:34 +04:00
|
|
|
persisted in the database.
|
|
|
|
|
2015-02-02 22:12:04 +03:00
|
|
|
|
2015-01-17 02:55:11 +03:00
|
|
|
.. automodule:: airflow.models
|
2014-10-20 20:40:43 +04:00
|
|
|
:show-inheritance:
|
2015-01-17 19:26:11 +03:00
|
|
|
:members: DAG, BaseOperator, TaskInstance, DagBag, Connection
|
|
|
|
|
|
|
|
Hooks
|
|
|
|
-----
|
2018-02-21 04:01:13 +03:00
|
|
|
|
|
|
|
Hooks are interfaces to external platforms and databases, implementing a common
|
|
|
|
interface when possible and acting as building blocks for operators.
|
2017-12-22 15:54:19 +03:00
|
|
|
|
|
|
|
.. autoclass:: airflow.hooks.dbapi_hook.DbApiHook
|
|
|
|
.. autoclass:: airflow.hooks.docker_hook.DockerHook
|
|
|
|
.. automodule:: airflow.hooks.hive_hooks
|
2015-08-03 00:21:32 +03:00
|
|
|
:members:
|
2017-12-22 15:54:19 +03:00
|
|
|
HiveCliHook,
|
|
|
|
HiveMetastoreHook,
|
|
|
|
HiveServer2Hook
|
|
|
|
.. autoclass:: airflow.hooks.http_hook.HttpHook
|
2018-03-19 11:41:20 +03:00
|
|
|
.. autoclass:: airflow.hooks.druid_hook.DruidDbApiHook
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.hooks.druid_hook.DruidHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.hooks.hdfs_hook.HDFSHook
|
2018-03-13 06:38:59 +03:00
|
|
|
.. autoclass:: airflow.hooks.jdbc_hook.JdbcHook
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.hooks.mssql_hook.MsSqlHook
|
|
|
|
.. autoclass:: airflow.hooks.mysql_hook.MySqlHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.hooks.oracle_hook.OracleHook
|
|
|
|
.. autoclass:: airflow.hooks.pig_hook.PigCliHook
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.hooks.postgres_hook.PostgresHook
|
|
|
|
.. autoclass:: airflow.hooks.presto_hook.PrestoHook
|
|
|
|
.. autoclass:: airflow.hooks.S3_hook.S3Hook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.hooks.samba_hook.SambaHook
|
|
|
|
.. autoclass:: airflow.hooks.slack_hook.SlackHook
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.hooks.sqlite_hook.SqliteHook
|
|
|
|
.. autoclass:: airflow.hooks.webhdfs_hook.WebHDFSHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.hooks.zendesk_hook.ZendeskHook
|
2014-10-13 09:05:34 +04:00
|
|
|
|
2015-10-06 02:30:22 +03:00
|
|
|
Community contributed hooks
|
2015-09-19 17:53:45 +03:00
|
|
|
'''''''''''''''''''''''''''
|
2018-05-08 21:12:52 +03:00
|
|
|
.. Alphabetize this list
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.aws_dynamodb_hook.AwsDynamoDBHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.aws_hook.AwsHook
|
2018-04-20 11:05:31 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.aws_lambda_hook.AwsLambdaHook
|
2018-06-19 00:23:53 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.azure_data_lake_hook.AzureDataLakeHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.azure_fileshare_hook.AzureFileShareHook
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.bigquery_hook.BigQueryHook
|
2018-05-18 04:01:41 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.cassandra_hook.CassandraHook
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.cloudant_hook.CloudantHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.databricks_hook.DatabricksHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.datadog_hook.DatadogHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.datastore_hook.DatastoreHook
|
2018-03-31 21:12:33 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.discord_webhook_hook.DiscordWebhookHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.emr_hook.EmrHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.fs_hook.FSHook
|
2018-04-20 11:05:31 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.ftp_hook.FTPHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.ftp_hook.FTPSHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook
|
2018-06-15 22:44:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.gcp_container_hook.GKEClusterHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.gcp_dataflow_hook.DataFlowHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.gcp_dataproc_hook.DataProcHook
|
2018-04-20 11:05:31 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.gcp_mlengine_hook.MLEngineHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.gcp_pubsub_hook.PubSubHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.gcs_hook.GoogleCloudStorageHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.jenkins_hook.JenkinsHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.jira_hook.JiraHook
|
2018-06-06 01:30:02 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.mongo_hook.MongoHook
|
2018-04-30 09:41:43 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.pinot_hook.PinotDbApiHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.qubole_hook.QuboleHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.redis_hook.RedisHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.redshift_hook.RedshiftHook
|
2018-04-20 11:05:31 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.salesforce_hook.SalesforceHook
|
2018-05-11 10:25:19 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.segment_hook.SegmentHook
|
2018-04-11 12:55:29 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.sftp_hook.SFTPHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.slack_webhook_hook.SlackWebhookHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.snowflake_hook.SnowflakeHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.spark_jdbc_hook.SparkJDBCHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.spark_sql_hook.SparkSqlHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.spark_submit_hook.SparkSubmitHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.sqoop_hook.SqoopHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.ssh_hook.SSHHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.vertica_hook.VerticaHook
|
|
|
|
.. autoclass:: airflow.contrib.hooks.wasb_hook.WasbHook
|
2018-05-08 21:12:52 +03:00
|
|
|
.. autoclass:: airflow.contrib.hooks.winrm_hook.WinRMHook
|
2016-06-29 23:39:15 +03:00
|
|
|
|
2014-10-13 09:05:34 +04:00
|
|
|
Executors
|
|
|
|
---------
|
2015-04-21 17:41:17 +03:00
|
|
|
Executors are the mechanism by which task instances get run.
|
2015-01-18 02:27:01 +03:00
|
|
|
|
2017-12-22 15:54:19 +03:00
|
|
|
.. autoclass:: airflow.executors.local_executor.LocalExecutor
|
|
|
|
.. autoclass:: airflow.executors.celery_executor.CeleryExecutor
|
|
|
|
.. autoclass:: airflow.executors.sequential_executor.SequentialExecutor
|
2015-10-06 02:30:22 +03:00
|
|
|
|
2015-10-15 00:59:14 +03:00
|
|
|
Community-contributed executors
|
2015-10-06 02:30:22 +03:00
|
|
|
'''''''''''''''''''''''''''''''
|
|
|
|
|
2016-06-29 23:39:15 +03:00
|
|
|
.. autoclass:: airflow.contrib.executors.mesos_executor.MesosExecutor
|