Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for duplicate container while retrying executions #1096

Merged
merged 4 commits into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading