Skip to content

Commit 9d207a1

Browse files
UN-2813 Reverted unwanted changes
1 parent b4edb40 commit 9d207a1

File tree

113 files changed

+11109
-8544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+11109
-8544
lines changed

.github/workflows/ci-test.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,22 @@ jobs:
4848
run: |
4949
tox
5050
51-
- name: Render the report to the PR
52-
uses: marocchino/sticky-pull-request-comment@v2
51+
- name: Render the Runner report to the PR
52+
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
53+
if: always() && hashFiles('runner-report.md') != ''
5354
with:
5455
header: runner-test-report
5556
recreate: true
5657
path: runner-report.md
5758

59+
- name: Render the SDK1 report to the PR
60+
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
61+
if: always() && hashFiles('sdk1-report.md') != ''
62+
with:
63+
header: sdk1-test-report
64+
recreate: true
65+
path: sdk1-report.md
66+
5867
- name: Output reports to the job summary when tests fail
5968
shell: bash
6069
run: |
@@ -65,3 +74,10 @@ jobs:
6574
echo "" >> $GITHUB_STEP_SUMMARY
6675
echo "</details>" >> $GITHUB_STEP_SUMMARY
6776
fi
77+
if [ -f "sdk1-report.md" ]; then
78+
echo "<details><summary>SDK1 Test Report</summary>" >> $GITHUB_STEP_SUMMARY
79+
echo "" >> $GITHUB_STEP_SUMMARY
80+
cat "sdk1-report.md" >> $GITHUB_STEP_SUMMARY
81+
echo "" >> $GITHUB_STEP_SUMMARY
82+
echo "</details>" >> $GITHUB_STEP_SUMMARY
83+
fi

backend/backend/settings/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ def get_required_setting(setting_key: str, default: str | None = None) -> str |
160160
os.environ.get("FILE_EXECUTION_TRACKER_COMPLETED_TTL_IN_SECOND", 60 * 10)
161161
) # 10 minutes
162162

163+
FILE_ACTIVE_CACHE_REDIS_DB = int(
164+
os.environ.get("FILE_ACTIVE_CACHE_REDIS_DB", 0)
165+
) # Redis DB for active file cache tracking
166+
163167
INSTANT_WF_POLLING_TIMEOUT = int(
164168
os.environ.get("INSTANT_WF_POLLING_TIMEOUT", "300")
165169
) # 5 minutes
@@ -175,7 +179,7 @@ def get_required_setting(setting_key: str, default: str | None = None) -> str |
175179
os.environ.get("MAX_PARALLEL_FILE_BATCHES_MAX_VALUE", 100)
176180
)
177181

178-
CELERY_RESULT_CHORD_RETRY_INTERVAL = int(
182+
CELERY_RESULT_CHORD_RETRY_INTERVAL = float(
179183
os.environ.get("CELERY_RESULT_CHORD_RETRY_INTERVAL", "3")
180184
)
181185

backend/pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ dependencies = [
3535
"python-socketio==5.9.0", # For log_events
3636
"social-auth-app-django==5.3.0", # For OAuth
3737
"social-auth-core==4.4.2", # For OAuth
38-
# TODO: Temporarily removing the extra dependencies of aws and gcs from unstract-sdk
39-
# to resolve lock file. Will have to be re-looked into
40-
"unstract-sdk[azure]~=0.77.3",
41-
"gcsfs==2024.10.0",
42-
"s3fs==2024.10.0",
38+
"unstract-sdk[aws,gcs,azure]~=0.78.0",
4339
"azure-identity==1.16.0",
4440
"azure-mgmt-apimanagement==3.0.0",
4541
"croniter>=3.0.3",
@@ -50,7 +46,7 @@ dependencies = [
5046
"unstract-core",
5147
"unstract-filesystem",
5248
"unstract-flags",
53-
"unstract-sdk1",
49+
"unstract-sdk1[aws,gcs,azure]",
5450
"unstract-tool-registry",
5551
"unstract-tool-sandbox",
5652
"unstract-workflow-execution",

backend/sample.env

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ PROMPT_STUDIO_FILE_PATH=/app/prompt-studio-data
7878

7979
# Structure Tool Image (Runs prompt studio exported tools)
8080
# https://hub.docker.com/r/unstract/tool-structure
81-
STRUCTURE_TOOL_IMAGE_URL="docker:unstract/tool-structure:0.0.88"
81+
STRUCTURE_TOOL_IMAGE_URL="docker:unstract/tool-structure:0.0.89"
8282
STRUCTURE_TOOL_IMAGE_NAME="unstract/tool-structure"
83-
STRUCTURE_TOOL_IMAGE_TAG="0.0.88"
83+
STRUCTURE_TOOL_IMAGE_TAG="0.0.89"
8484

8585
# Feature Flags
8686
EVALUATION_SERVER_IP=unstract-flipt
@@ -200,3 +200,6 @@ RUNNER_POLLING_INTERVAL_SECONDS=2
200200
# Default: 1800 seconds (30 minutes)
201201
# Examples: 900 (15 min), 1800 (30 min), 3600 (60 min)
202202
MIN_SCHEDULE_INTERVAL_SECONDS=1800
203+
204+
# File active cache redis db
205+
FILE_ACTIVE_CACHE_REDIS_DB=0

backend/utils/cache_service.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,18 @@ def clear_cache(key_pattern: str) -> Any:
4343
cache.delete_pattern(key_pattern)
4444

4545
@staticmethod
46-
def clear_cache_optimized(key_pattern: str) -> Any:
46+
def clear_cache_optimized(key_pattern: str, db: int | None = None) -> Any:
4747
"""Delete keys in bulk using optimized SCAN approach for large datasets.
4848
4949
Uses Redis SCAN instead of KEYS to avoid blocking Redis during deletion.
5050
Safe for production with large key sets. Use this for heavy operations
5151
like workflow history clearing.
52+
53+
Args:
54+
key_pattern: Pattern to match keys for deletion (e.g., "file_active:*")
55+
db: Optional Redis database number. If provided, clears from that specific DB.
56+
If None, uses the default Django cache connection (typically DB 0).
57+
Use db=1 for worker cache entries (file_active:*, etc.)
5258
"""
5359
TIMEOUT_SECONDS = 90 # Generous but bounded timeout
5460
BATCH_SIZE = 1000
@@ -58,6 +64,20 @@ def clear_cache_optimized(key_pattern: str) -> Any:
5864
cursor = 0
5965
completed_naturally = False
6066

67+
# Use specified DB or default connection
68+
if db is not None:
69+
import redis
70+
71+
redis_connection = redis.Redis(
72+
host=settings.REDIS_HOST,
73+
port=settings.REDIS_PORT,
74+
db=db,
75+
username=getattr(settings, "REDIS_USER", None),
76+
password=getattr(settings, "REDIS_PASSWORD", None),
77+
)
78+
else:
79+
redis_connection = redis_cache
80+
6181
try:
6282
while True:
6383
# Check timeout first
@@ -69,13 +89,13 @@ def clear_cache_optimized(key_pattern: str) -> Any:
6989
break
7090

7191
# SCAN returns (next_cursor, keys_list)
72-
cursor, keys = redis_cache.scan(
92+
cursor, keys = redis_connection.scan(
7393
cursor=cursor, match=key_pattern, count=BATCH_SIZE
7494
)
7595

7696
if keys:
7797
# Delete keys in pipeline for efficiency
78-
pipe = redis_cache.pipeline()
98+
pipe = redis_connection.pipeline()
7999
for key in keys:
80100
pipe.delete(key)
81101
pipe.execute()

0 commit comments

Comments
 (0)