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

pierrejeambrun pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 21753456ed93158926a8cbc35b95875e899ca1cd
Author: Josh Fell <[email protected]>
AuthorDate: Wed Mar 15 22:51:27 2023 -0400

    Add custom_operator_name to @task.sensor tasks (#30131)
    
    Current the operator name for TaskFlow tasks using the `@task.sensor` 
decorator was still "DecoratedSensorOperator". To keep consistent with the 
other TaskFlow decorators, adding a `custom_operator_name` for these tasks.
    
    (cherry picked from commit 2842a0f30b11c790465ca6f8679358abb5a3f902)
---
 airflow/decorators/sensor.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/airflow/decorators/sensor.py b/airflow/decorators/sensor.py
index 8ef9b2e6d6..d52a0ffbb2 100644
--- a/airflow/decorators/sensor.py
+++ b/airflow/decorators/sensor.py
@@ -40,6 +40,8 @@ class DecoratedSensorOperator(PythonSensor):
     template_fields: Sequence[str] = ("op_args", "op_kwargs")
     template_fields_renderers: dict[str, str] = {"op_args": "py", "op_kwargs": 
"py"}
 
+    custom_operator_name = "@task.sensor"
+
     # since we won't mutate the arguments, we should just do the shallow copy
     # there are some cases we can't deepcopy the objects (e.g protobuf).
     shallow_copy_attrs: Sequence[str] = ("python_callable",)

Reply via email to