Skip to content

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

[MISC] Move Redis clients to unstract-core for better code organization (#1613)

Chandrasekharan M7d1a01b6053c
diff --git a/unstract/core/src/unstract/core/cache/__init__.py b/unstract/core/src/unstract/core/cache/__init__.py
new file mode 100644
index 000000000..f13c7c536
--- /dev/null
+++ b/unstract/core/src/unstract/core/cache/__init__.py
@@ -0,0 +1,9 @@
+"""Redis Cache Clients for Unstract.
+
+This module provides Redis client implementations for caching and queue operations.
+"""
+
+from .redis_client import RedisClient
+from .redis_queue_client import RedisQueueClient
+
+__all__ = ["RedisClient", "RedisQueueClient"]
diff --git a/workers/shared/cache/redis_client.py b/unstract/core/src/unstract/core/cache/redis_client.py
similarity index 100%
rename from workers/shared/cache/redis_client.py
rename to unstract/core/src/unstract/core/cache/redis_client.py
diff --git a/workers/shared/cache/redis_queue_client.py b/unstract/core/src/unstract/core/cache/redis_queue_client.py
similarity index 98%
rename from workers/shared/cache/redis_queue_client.py
rename to unstract/core/src/unstract/core/cache/redis_queue_client.py
index 026cc9397..0a9362bc4 100644
--- a/workers/shared/cache/redis_queue_client.py
+++ b/unstract/core/src/unstract/core/cache/redis_queue_client.py
@@ -7,7 +7,7 @@ Inherits from RedisClient for basic Redis functionality.
import logging
from typing import Any
-from .redis_client import RedisClient
+from unstract.core.cache.redis_client import RedisClient
logger = logging.getLogger(__name__)
diff --git a/workers/log_consumer/process_log_history.py b/workers/log_consumer/process_log_history.py
index fb6ece406..a941bb060 100755
--- a/workers/log_consumer/process_log_history.py
+++ b/workers/log_consumer/process_log_history.py
@@ -17,7 +17,8 @@ import os
import sys
import httpx
-from shared.cache.redis_queue_client import RedisQueueClient
+
+from unstract.core.cache.redis_queue_client import RedisQueueClient
logger = logging.getLogger(__name__)
diff --git a/workers/log_consumer/tasks.py b/workers/log_consumer/tasks.py
index 93c44398a..eeae05f47 100644
--- a/workers/log_consumer/tasks.py
+++ b/workers/log_consumer/tasks.py
@@ -8,11 +8,11 @@ from typing import Any
import socketio
from celery import shared_task
-from shared.cache.redis_queue_client import RedisQueueClient
from shared.infrastructure.config import WorkerConfig
from shared.infrastructure.logging import WorkerLogger
from shared.utils.api_client_singleton import get_singleton_api_client
+from unstract.core.cache.redis_queue_client import RedisQueueClient
from unstract.core.constants import LogEventArgument, LogProcessingTask
from unstract.core.log_utils import store_execution_log
diff --git a/workers/shared/cache/cache_backends.py b/workers/shared/cache/cache_backends.py
index 695ba7665..24363801a 100644
--- a/workers/shared/cache/cache_backends.py
+++ b/workers/shared/cache/cache_backends.py
@@ -11,7 +11,7 @@ from abc import ABC, abstractmethod
from datetime import UTC, datetime
from typing import Any
-from .redis_client import RedisClient
+from unstract.core.cache.redis_client import RedisClient
logger = logging.getLogger(__name__)