dstandish commented on code in PR #27433:
URL: https://github.com/apache/airflow/pull/27433#discussion_r1016123175


##########
airflow/providers/cncf/kubernetes/decorators/kubernetes.py:
##########
@@ -57,7 +57,14 @@ def _read_file_contents(filename):
 class _KubernetesDecoratedOperator(DecoratedOperator, KubernetesPodOperator):
     custom_operator_name = "@task.kubernetes"
 
-    template_fields: Sequence[str] = ("op_args", "op_kwargs")
+    # This allows for jinja template rendering of the template_fields passed
+    # to the KubernetesPodOperator.
+    # cmds and arguments are specifically excluded as these are explicitly
+    # used when running the python file generated from the code
+    # below the decorator.
+    template_fields: Sequence[str] = tuple(
+        {"op_args", "op_kwargs"} | set(KubernetesPodOperator.template_fields) 
- {"cmds", "arguments"}
+    )

Review Comment:
   ever so marginally cleaner...
   
   ```suggestion
       template_fields: Sequence[str] = tuple(
           {"op_args", "op_kwargs", *KubernetesPodOperator.template_fields} - 
{"cmds", "arguments"}
       )
   ```



##########
airflow/providers/cncf/kubernetes/decorators/kubernetes.py:
##########
@@ -57,7 +57,14 @@ def _read_file_contents(filename):
 class _KubernetesDecoratedOperator(DecoratedOperator, KubernetesPodOperator):
     custom_operator_name = "@task.kubernetes"
 
-    template_fields: Sequence[str] = ("op_args", "op_kwargs")
+    # This allows for jinja template rendering of the template_fields passed
+    # to the KubernetesPodOperator.
+    # cmds and arguments are specifically excluded as these are explicitly
+    # used when running the python file generated from the code
+    # below the decorator.

Review Comment:
   ```suggestion
       # `cmds` and `arguments` are used internally by the operator
   ```



-- 
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