uranusjr commented on code in PR #59656:
URL: https://github.com/apache/airflow/pull/59656#discussion_r2639037594


##########
airflow-core/docs/core-concepts/operators.rst:
##########
@@ -344,4 +344,41 @@ If you need to include a Jinja template expression (e.g., 
``{{ ds }}``) literall
       dag=dag,
   )
 
-This ensures the f-string processing results in a string containing the 
literal double braces required by Jinja, which Airflow can then template 
correctly before execution. Failure to do this is a common issue for beginners 
and can lead to errors during Dag parsing or unexpected behavior at runtime 
when the templating does not occur as expected.
+This ensures the f-string processing results in a string containing the 
literal double braces required by Jinja, which Airflow can then template 
correctly before execution. Failure to do this is a common issue for beginners 
and can lead to errors during DAG parsing or unexpected behavior at runtime 
when the templating does not occur as expected.
+
+Pre- and post-execute methods
+-----------------------------
+
+The ``pre_execute`` and ``post_execute`` methods are called before and after 
the operator is executed, respectively.
+
+For example, you can use the ``pre_execute`` method to elegantly determine if 
a task should be executed or not:
+
+.. code-block:: python
+
+    def _check_skipped(context: Any) -> None:
+        """
+        Check if a given task instance should be skipped if the 
`tasks_to_skip` Airflow Variable is a list that contains the task id.
+        """
+        tasks_to_skip = Variable.get("tasks_to_skip", deserialize_json=True)
+        if context["task"].task_id in on_ice:
+            raise AirflowSkipException("Task instance configured to be skipped 
by `tasks_to_skip` variable.")
+
+
+    ...

Review Comment:
   Let’s remove this `...` since it affects the layout a lot. I think people 
can understand things can go between these functions without this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to