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 2022/11/07 18:46:52 UTC

[GitHub] [airflow] dstandish commented on a diff in pull request #27524: Improve task_id to pod name conversion

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


##########
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py:
##########
@@ -62,6 +62,23 @@
     from airflow.utils.context import Context
 
 
+def _task_id_to_pod_name(val):
+    val = val.lower()
+    first = val[0]
+    if not re.match(r"[a-z0-9]", first):
+        val = "0" + val
+    last = val[-1]
+    if not re.match(r"[a-z0-9]", last):
+        val = val + "0"
+    val = re.sub(r"[^a-z0-9\-.]", "-", val)
+    if len(val) > 253:

Review Comment:
   That's true. I didn't discover that until writing tests.  But yeah, I left it in because, well, i already put it in and, anyway probably might as well apply the actual rules, and not depending on how task_id is implemented -- which is something that could change, at least in theory..



-- 
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: commits-unsubscribe@airflow.apache.org

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