Skip to content

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

fix for duplicate container while retrying executions (#1096)

alidf47b4ab79ce
diff --git a/unstract/core/src/unstract/core/utilities.py b/unstract/core/src/unstract/core/utilities.py
index 89213e49f..34d5c1729 100644
--- a/unstract/core/src/unstract/core/utilities.py
+++ b/unstract/core/src/unstract/core/utilities.py
@@ -1,5 +1,6 @@
import logging
import os
+import uuid
from typing import Optional
logger = logging.getLogger()
@@ -31,7 +32,10 @@ class UnstractUtils:
def build_tool_container_name(
tool_image: str, tool_version: str, run_id: str
) -> str:
- container_name = f"{tool_image.split('/')[-1]}-{tool_version}-{run_id}"
+ tool_name = tool_image.split("/")[-1]
+ # TODO: Add execution attempt to better track instead of uuid
+ short_uuid = uuid.uuid4().hex[:6] # To avoid duplicate name collision
+ container_name = f"{tool_name}-{tool_version}-{short_uuid}-{run_id}"
# To support limits of container clients like K8s
if len(container_name) > 63: