eilon246810 commented on code in PR #43601:
URL: https://github.com/apache/airflow/pull/43601#discussion_r1826556814


##########
providers/src/airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -388,7 +390,8 @@ def __init__(
         self.priority_class_name = priority_class_name
         self.pod_template_file = pod_template_file
         self.pod_template_dict = pod_template_dict
-        self.name = self._set_name(name)
+        name = self._set_name(name)
+        self.name = name

Review Comment:
   I tried implementing it with `self.name = self._set_name(name)` but there is 
a pre-commit check that failed when I did that - "No templated field logic 
checks in operator __init__":
   ```
   No templated field logic checks in operator 
__init__........................Failed
   - hook id: validate-operators-init
   - exit code: 2
   
   providers/src/airflow/providers/cncf/kubernetes/operators/pod.py
   KubernetesPodOperator's constructor lacks direct assignments for instance 
members corresponding to the following template fields (i.e., self.field_name = 
field_name or
   super.__init__(field_name=field_name, ...) ):
   ['name']
   KubernetesPodOperator's constructor contains invalid assignments to the 
following instance members that should be corresponding to template fields 
(i.e., self.field_name = field_name):
   ['self.name']
   ```
   How do you think it's best to overcome this?
   Also - I didn't understand what's the purpose of this pre-commit check?



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