blob: 0b0411245e2c81d389e87f3d6dfde1f5cb6460ab [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Reference &mdash; Airflow Documentation</title>
<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="airflow.operators" href="airflow/operators/index.html" />
<link rel="prev" title="Macros reference" href="../macros.html" />
<script>
document.addEventListener('DOMContentLoaded', function() {
var el = document.getElementById('changelog');
if (el !== null ) {
// [AIRFLOW-...]
el.innerHTML = el.innerHTML.replace(
/\[(AIRFLOW-[\d]+)\]/g,
`<a href="https://issues.apache.org/jira/browse/$1">[$1]</a>`
);
// (#...)
el.innerHTML = el.innerHTML.replace(
/\(#([\d]+)\)/g,
`<a href="https://github.com/apache/airflow/pull/$1">(#$1)</a>`
);
};
})
</script>
<style>
.example-header {
position: relative;
background: #9AAA7A;
padding: 8px 16px;
margin-bottom: 0;
}
.example-header--with-button {
padding-right: 166px;
}
.example-header:after{
content: '';
display: table;
clear: both;
}
.example-title {
display:block;
padding: 4px;
margin-right: 16px;
color: white;
overflow-x: auto;
}
.example-header-button {
top: 8px;
right: 16px;
position: absolute;
}
.example-header + .highlight-python {
margin-top: 0 !important;
}
.viewcode-button {
display: inline-block;
padding: 8px 16px;
border: 0;
margin: 0;
outline: 0;
border-radius: 2px;
-webkit-box-shadow: 0 3px 5px 0 rgba(0,0,0,.3);
box-shadow: 0 3px 6px 0 rgba(0,0,0,.3);
color: #404040;
background-color: #e7e7e7;
cursor: pointer;
font-size: 16px;
font-weight: 500;
line-height: 1;
text-decoration: none;
text-overflow: ellipsis;
overflow: hidden;
text-transform: uppercase;
-webkit-transition: background-color .2s;
transition: background-color .2s;
vertical-align: middle;
white-space: nowrap;
}
.viewcode-button:visited {
color: #404040;
}
.viewcode-button:hover, .viewcode-button:focus {
color: #404040;
background-color: #d6d6d6;
}
</style>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> Airflow
</a>
<div class="version">
1.10.4
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../project.html">Project</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="../start.html">Quick Start</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../howto/index.html">How-to Guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ui.html">UI / Screenshots</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../profiling.html">Data Profiling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../cli.html">Command Line Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="../scheduler.html">Scheduling &amp; Triggers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../plugins.html">Plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security.html">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../timezone.html">Time zones</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Experimental Rest API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../integration.html">Integration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../metrics.html">Metrics</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kubernetes.html">Kubernetes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../lineage.html">Lineage</a></li>
<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../macros.html">Macros reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#operators">Operators</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#baseoperator">BaseOperator</a></li>
<li class="toctree-l3"><a class="reference internal" href="#basesensoroperator">BaseSensorOperator</a></li>
<li class="toctree-l3"><a class="reference internal" href="#operators-packages">Operators packages</a><ul>
<li class="toctree-l4"><a class="reference internal" href="airflow/operators/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.operators</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="airflow/sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.sensors</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="airflow/contrib/operators/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="airflow/contrib/sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.sensors</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#hooks">Hooks</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#hooks-packages">Hooks packages</a><ul>
<li class="toctree-l4"><a class="reference internal" href="airflow/hooks/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.hooks</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="airflow/contrib/hooks/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.hooks</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#executors">Executors</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#executors-packages">Executors packages</a><ul>
<li class="toctree-l4"><a class="reference internal" href="airflow/executors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.executors</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="airflow/contrib/executors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.executors</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#models">Models</a><ul>
<li class="toctree-l3"><a class="reference internal" href="airflow/models/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.models</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#core-and-community-package">Core and community package</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Airflow</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> &raquo;</li>
<li>API Reference</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/_api/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="api-reference">
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline"></a></h1>
<div class="section" id="operators">
<h2>Operators<a class="headerlink" href="#operators" title="Permalink to this headline"></a></h2>
<p>Operators allow for generation of certain types of tasks that become nodes in
the DAG when instantiated. All operators derive from <a class="reference internal" href="airflow/models/index.html#airflow.models.BaseOperator" title="airflow.models.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseOperator</span></code></a> and
inherit many attributes and methods that way.</p>
<p>There are 3 main types of operators:</p>
<ul class="simple">
<li><p>Operators that performs an <strong>action</strong>, or tell another system to
perform an action</p></li>
<li><p><strong>Transfer</strong> operators move data from one system to another</p></li>
<li><p><strong>Sensors</strong> 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
S3, a partition appearing in Hive, or a specific time of the day. Sensors
are derived from <a class="reference internal" href="airflow/sensors/base_sensor_operator/index.html#airflow.sensors.base_sensor_operator.BaseSensorOperator" title="airflow.sensors.base_sensor_operator.BaseSensorOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseSensorOperator</span></code></a> and run a poke
method at a specified <code class="xref py py-attr docutils literal notranslate"><span class="pre">poke_interval</span></code> until it returns <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p></li>
</ul>
<div class="section" id="baseoperator">
<h3>BaseOperator<a class="headerlink" href="#baseoperator" title="Permalink to this headline"></a></h3>
<p>All operators are derived from <a class="reference internal" href="airflow/models/index.html#airflow.models.BaseOperator" title="airflow.models.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseOperator</span></code></a> 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 <a class="reference internal" href="airflow/models/index.html#airflow.models.BaseOperator" title="airflow.models.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseOperator</span></code></a>
to understand the primitive features that can be leveraged in your
DAGs.</p>
</div>
<div class="section" id="basesensoroperator">
<h3>BaseSensorOperator<a class="headerlink" href="#basesensoroperator" title="Permalink to this headline"></a></h3>
<p>All sensors are derived from <a class="reference internal" href="airflow/sensors/base_sensor_operator/index.html#airflow.sensors.base_sensor_operator.BaseSensorOperator" title="airflow.sensors.base_sensor_operator.BaseSensorOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseSensorOperator</span></code></a>. All sensors inherit
the <code class="xref py py-attr docutils literal notranslate"><span class="pre">timeout</span></code> and <code class="xref py py-attr docutils literal notranslate"><span class="pre">poke_interval</span></code> on top of the <a class="reference internal" href="airflow/models/index.html#airflow.models.BaseOperator" title="airflow.models.BaseOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseOperator</span></code></a>
attributes.</p>
</div>
<div class="section" id="operators-packages">
<h3>Operators packages<a class="headerlink" href="#operators-packages" title="Permalink to this headline"></a></h3>
<p>All operators are in the following packages:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="airflow/operators/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.operators</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="airflow/sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.sensors</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="airflow/contrib/operators/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.operators</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="airflow/contrib/sensors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.sensors</span></code></a></li>
</ul>
</div>
</div>
</div>
<div class="section" id="hooks">
<h2>Hooks<a class="headerlink" href="#hooks" title="Permalink to this headline"></a></h2>
<p>Hooks are interfaces to external platforms and databases, implementing a common
interface when possible and acting as building blocks for operators. All hooks
are derived from <a class="reference internal" href="airflow/hooks/base_hook/index.html#airflow.hooks.base_hook.BaseHook" title="airflow.hooks.base_hook.BaseHook"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseHook</span></code></a>.</p>
<div class="section" id="hooks-packages">
<h3>Hooks packages<a class="headerlink" href="#hooks-packages" title="Permalink to this headline"></a></h3>
<p>All hooks are in the following packages:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="airflow/hooks/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.hooks</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="airflow/contrib/hooks/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.hooks</span></code></a></li>
</ul>
</div>
</div>
</div>
<div class="section" id="executors">
<h2>Executors<a class="headerlink" href="#executors" title="Permalink to this headline"></a></h2>
<p>Executors are the mechanism by which task instances get run. All executors are
derived from <a class="reference internal" href="airflow/executors/base_executor/index.html#airflow.executors.base_executor.BaseExecutor" title="airflow.executors.base_executor.BaseExecutor"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseExecutor</span></code></a>.</p>
<div class="section" id="executors-packages">
<h3>Executors packages<a class="headerlink" href="#executors-packages" title="Permalink to this headline"></a></h3>
<p>All executors are in the following packages:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="airflow/executors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.executors</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="airflow/contrib/executors/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.contrib.executors</span></code></a></li>
</ul>
</div>
</div>
</div>
<div class="section" id="models">
<h2>Models<a class="headerlink" href="#models" title="Permalink to this headline"></a></h2>
<p>Models are built on top of the SQLAlchemy ORM Base class, and instances are
persisted in the database.</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="airflow/models/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">airflow.models</span></code></a></li>
</ul>
</div>
</div>
<div class="section" id="core-and-community-package">
<h2>Core and community package<a class="headerlink" href="#core-and-community-package" title="Permalink to this headline"></a></h2>
<p>Formerly the core code was maintained by the original creators - Airbnb. The code
that was in the contrib package was supported by the community. The project
was passed to the Apache community and currently the entire code is
maintained by the community, so now the division has no justification,
and it is only due to historical reasons. Currently, all new classes are
added only to the contrib package.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="airflow/operators/index.html" class="btn btn-neutral float-right" title="airflow.operators" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="../macros.html" class="btn btn-neutral float-left" title="Macros reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>