incubator-airflow/docs/code.rst

105 строки
3.4 KiB
ReStructuredText
Исходник Обычный вид История

2014-10-13 09:05:34 +04:00
Code / API
==========
Operators
---------
Operators allows to generate a certain type of task that become a node in
the DAG when instantiated. All operators derive from BaseOperator and
inherit a whole lot of attributes and method that way. Refer to the
BaseOperator documentation for more details.
.. automodule:: airflow.operators
:show-inheritance:
2015-02-03 09:09:49 +03:00
:members:
HiveOperator,
MySqlOperator,
BashOperator,
PythonOperator,
2015-02-03 09:09:49 +03:00
ExternalTaskSensor,
SqlSensor,
HivePartitionSensor,
HdfsSensor,
2015-02-17 19:28:57 +03:00
TimeSensor,
2015-02-03 09:09:49 +03:00
PrestoCheckOperator,
PrestoIntervalCheckOperator,
PrestoValueCheckOperator,
Hive2SambaOperator,
DummyOperator,
EmailOperator
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``
``{{ yesterday_ds }}`` yesterday's date as ``YYYY-MM-DD``
``{{ tomorrow_ds }}`` tomorrow's date as ``YYYY-MM-DD``
``{{ ds }}`` the execution date as ``YYYY-MM-DD``
2015-02-03 09:09:49 +03:00
``{{ execution_date }}`` the execution_date, (datateime.datetime)
``{{ dag }}`` the DAG object
``{{ task }}`` the Task object
``{{ macros }}`` a reference to the macros package, described bellow
``{{ task_instance }}`` the task_instance object
``{{ ds_nodash }}`` the execution date as ``YYYYMMDD``
``{{ end_date }}`` same as ``{{ ds }}``
``{{ lastest_date }}`` same as ``{{ ds }}``
``{{ ti }}`` same as ``{{ task_instance }}``
``{{ params }}`` a reference to the user defined params dictionary
``{{ task_instance_key_str }}`` a unique, human readable key to the task instance
formatted ``{dag_id}_{task_id}_{ds}``
================================= ====================================
Note that you can access the objects attributes and methods with simple
dot notation. Here are some examples of what is possible:
``{{ task.owner }}``, ``{{ task.task_id }}``, ``{{ ti.hostname }}``, ...
Refer to the models documentation for more information on the objects
attributes and methods.
Macros
''''''
These macros live under the ``macros`` namespace in your templates.
.. automodule:: airflow.macros
:show-inheritance:
:members:
.. automodule:: airflow.macros.hive
:show-inheritance:
:members:
.. _models_ref:
2014-10-13 09:05:34 +04:00
Models
------
2014-10-13 09:05:34 +04:00
Models are built on top of th SQLAlchemy ORM Base class, instance are
persisted in the database.
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
-----
.. automodule:: airflow.hooks
:show-inheritance:
2015-02-26 04:13:07 +03:00
:members: MySqlHook, PrestoHook, HiveCliHook, HiveServer2Hook, HiveMetastoreHook
2014-10-13 09:05:34 +04:00
Executors
---------
2015-01-17 19:26:11 +03:00
Executors are the mechanism by which task instances get run.
2015-01-18 02:27:01 +03:00
2015-01-17 02:55:11 +03:00
.. automodule:: airflow.executors
2015-01-17 19:26:11 +03:00
:show-inheritance:
:members: LocalExecutor, CeleryExecutor, SequentialExecutor