You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/01/13 20:23:47 UTC
[airflow] branch master updated: Add how to use custom operators
within plugins folder (#13186)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new f1d4b4c Add how to use custom operators within plugins folder (#13186)
f1d4b4c is described below
commit f1d4b4cf6d37bd22173888e04c25bd404f661621
Author: JavierLopezT <ja...@gmail.com>
AuthorDate: Wed Jan 13 21:23:32 2021 +0100
Add how to use custom operators within plugins folder (#13186)
Co-authored-by: javier.lopez <ja...@promocionesfarma.com>
---
docs/apache-airflow/howto/custom-operator.rst | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/docs/apache-airflow/howto/custom-operator.rst b/docs/apache-airflow/howto/custom-operator.rst
index f6bb443..a804f6e 100644
--- a/docs/apache-airflow/howto/custom-operator.rst
+++ b/docs/apache-airflow/howto/custom-operator.rst
@@ -73,6 +73,13 @@ You can now use the derived custom operator as follows:
with dag:
hello_task = HelloOperator(task_id='sample-task', name='foo_bar')
+You also can keep using your plugins folder for storing your custom operators. If you have the file
+``hello_operator.py`` within the plugins folder, you can import the operator as follows:
+
+.. code-block:: python
+
+ from hello_operator import HelloOperator
+
If an operator communicates with an external service (API, database, etc) it's a good idea
to implement the communication layer using a :ref:`custom-operator/hook`. In this way the implemented logic
can be reused by other users in different operators. Such approach provides better decoupling and