Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

feat: Tool container name validation for length < 63 (#697)

Chandrasekharan M30060abfc3be
diff --git a/unstract/core/src/unstract/core/utilities.py b/unstract/core/src/unstract/core/utilities.py
index ec3c81d14..89213e49f 100644
--- a/unstract/core/src/unstract/core/utilities.py
+++ b/unstract/core/src/unstract/core/utilities.py
@@ -1,6 +1,9 @@
+import logging
import os
from typing import Optional
+logger = logging.getLogger()
+
class UnstractUtils:
@staticmethod
@@ -28,4 +31,12 @@ class UnstractUtils:
def build_tool_container_name(
tool_image: str, tool_version: str, run_id: str
) -> str:
- return f"{tool_image.split('/')[-1]}-{tool_version}-{run_id}"
+ container_name = f"{tool_image.split('/')[-1]}-{tool_version}-{run_id}"
+
+ # To support limits of container clients like K8s
+ if len(container_name) > 63:
+ logger.warning(
+ f"Container name exceeds 63 char limit for '{container_name}', "
+ "truncating to 63 chars. There might be collisions in container names"
+ )
+ return container_name[:63]