Skip to content

Commit

Permalink
Moves airflow import in deprecated pod_generator to local (#39062)
Browse files Browse the repository at this point in the history
The import might be invoked when K8S executor starts with sentry on
and it might lead to circular imports

Related: #31442
  • Loading branch information
potiuk committed Apr 16, 2024
1 parent d82246a commit b59cef1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions airflow/providers/cncf/kubernetes/pod_generator_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b59cef1

Please sign in to comment.