You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/06 21:15:17 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #6377: Monitor pods by labels instead of names

kaxil commented on a change in pull request #6377:
URL: https://github.com/apache/airflow/pull/6377#discussion_r421026419



##########
File path: airflow/kubernetes/pod_generator.py
##########
@@ -66,6 +70,25 @@ class PodDefaults:
     )
 
 
+def make_safe_label_value(string):
+    """
+    Valid label values must be 63 characters or less and must be empty or begin and
+    end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_),
+    dots (.), and alphanumerics between.
+
+    If the label value is then greater than 63 chars once made safe, or differs in any
+    way from the original value sent to this function, then we need to truncate to
+    53chars, and append it with a unique hash.

Review comment:
       ```suggestion
       53 chars, and append it with a unique hash.
   ```

##########
File path: airflow/kubernetes/pod_generator.py
##########
@@ -66,6 +70,25 @@ class PodDefaults:
     )
 
 
+def make_safe_label_value(string):
+    """
+    Valid label values must be 63 characters or less and must be empty or begin and
+    end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_),
+    dots (.), and alphanumerics between.
+
+    If the label value is then greater than 63 chars once made safe, or differs in any

Review comment:
       ```suggestion
       If the label value is greater than 63 chars once made safe, or differs in any
   ```

##########
File path: airflow/kubernetes/pod_launcher.py
##########
@@ -116,9 +114,15 @@ def run_pod(
                 time.sleep(1)
             self.log.debug('Pod not yet started')
 
-        return self._monitor_pod(pod, get_logs)
+    def monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[State, Optional[str]]:
+        """
+        Monitors a pod and returns the final state
 
-    def _monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[State, Optional[str]]:
+        :param pod:
+        :@type V1Pod:
+        :param get_logs:
+        :return:

Review comment:
       Can we fill the info here !




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org