Skip to content

Commit

Permalink
fix for duplicate container while retrying executions
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammad-ali-e committed Jan 27, 2025
1 parent 4254402 commit c19b99f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion unstract/core/src/unstract/core/utilities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import uuid
from typing import Optional

logger = logging.getLogger()
Expand Down Expand Up @@ -31,7 +32,10 @@ def get_env(env_key: str, default: Optional[str] = None, raise_err=False) -> str
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:
Expand Down

0 comments on commit c19b99f

Please sign in to comment.