This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new b59cef1c83 Moves airflow import in deprecated pod_generator to local
(#39062)
b59cef1c83 is described below
commit b59cef1c8374d53e1ffdeb46c94e6c9ff30c239d
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Apr 16 15:20:53 2024 +0200
Moves airflow import in deprecated pod_generator to local (#39062)
The import might be invoked when K8S executor starts with sentry on
and it might lead to circular imports
Related: #31442
---
airflow/providers/cncf/kubernetes/pod_generator_deprecated.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/airflow/providers/cncf/kubernetes/pod_generator_deprecated.py
b/airflow/providers/cncf/kubernetes/pod_generator_deprecated.py
index 92baf41e68..9a978cbd08 100644
--- a/airflow/providers/cncf/kubernetes/pod_generator_deprecated.py
+++ b/airflow/providers/cncf/kubernetes/pod_generator_deprecated.py
@@ -31,8 +31,6 @@ import uuid
import re2
from kubernetes.client import models as k8s
-from airflow.utils.hashlib_wrapper import md5
-
MAX_POD_ID_LEN = 253
MAX_LABEL_LEN = 63
@@ -71,6 +69,8 @@ def make_safe_label_value(string):
way from the original value sent to this function, then we need to
truncate to
53 chars, and append it with a unique hash.
"""
+ from airflow.utils.hashlib_wrapper import md5
+
safe_label = re2.sub(r"^[^a-z0-9A-Z]*|[^a-zA-Z0-9_\-\.]|[^a-z0-9A-Z]*$",
"", string)
if len(safe_label) > MAX_LABEL_LEN or string != safe_label: