This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 926d9bd191 Mention context variables and logging (#24304)
926d9bd191 is described below

commit 926d9bd1911adf21665910a514d5f214b4a093b6
Author: Malthe Borch <[email protected]>
AuthorDate: Tue Jun 7 22:36:25 2022 +0200

    Mention context variables and logging (#24304)
    
    * Mention context variables and logging
    
    * Fix static checks
---
 docs/apache-airflow/concepts/taskflow.rst | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/docs/apache-airflow/concepts/taskflow.rst 
b/docs/apache-airflow/concepts/taskflow.rst
index 4cfc91f821..1c2d133fcf 100644
--- a/docs/apache-airflow/concepts/taskflow.rst
+++ b/docs/apache-airflow/concepts/taskflow.rst
@@ -63,6 +63,23 @@ You can also use a plain value or variable to call a 
TaskFlow function - for exa
 
 If you want to learn more about using TaskFlow, you should consult :doc:`the 
TaskFlow tutorial </tutorial_taskflow_api>`.
 
+Context
+-------
+
+When running your callable, Airflow will pass a set of keyword arguments that 
can be used in your function. This set of kwargs correspond exactly to the 
:ref:`context variables<templates:variables>` you can use in your Jinja 
templates.
+
+For this to work, you need to define ``**kwargs`` in your function header, or 
you can add directly the keyword arguments you would like to get such as 
``ti=None`` to have the task instance passed.
+
+Logging
+-------
+
+To use logging from your task functions, simply import and use Python's 
logging system:
+
+.. code-block:: python
+
+   logger = logging.getlogger("airflow.task")
+
+Every logging line created this way will be recorded in the task log.
 
 History
 -------

Reply via email to