OpenRAG 0.4.1.dev8__py3-none-any.whl → 0.4.1.dev9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
api/settings.py CHANGED
@@ -1664,8 +1664,6 @@ async def rollback_onboarding(
1664
1664
  {"error": "No onboarding configuration to rollback"}, status_code=400
1665
1665
  )
1666
1666
 
1667
- jwt_token = user.jwt_token
1668
-
1669
1667
  logger.info("Rolling back onboarding configuration due to file failures")
1670
1668
 
1671
1669
  # Get all tasks for the user
@@ -1728,7 +1726,7 @@ async def rollback_onboarding(
1728
1726
  if filename:
1729
1727
  try:
1730
1728
  opensearch_client = session_manager.get_user_opensearch_client(
1731
- user.user_id, jwt_token
1729
+ user.user_id, user.jwt_token
1732
1730
  )
1733
1731
  from utils.opensearch_queries import build_filename_delete_body
1734
1732
  from config.settings import get_index_name
main.py CHANGED
@@ -1890,6 +1890,16 @@ async def create_app():
1890
1890
  await TelemetryClient.send_event(
1891
1891
  Category.APPLICATION_SHUTDOWN, MessageId.ORB_APP_SHUTDOWN
1892
1892
  )
1893
+ logger.info("Application shutdown initiated")
1894
+
1895
+ # Gracefully shutdown OpenSearch connection first
1896
+ try:
1897
+ from utils.opensearch_utils import graceful_opensearch_shutdown
1898
+ await graceful_opensearch_shutdown(clients.opensearch)
1899
+ clients.opensearch = None # prevent double-close in clients.cleanup()
1900
+ except Exception as e:
1901
+ logger.error("Error during graceful OpenSearch shutdown", error=str(e))
1902
+
1893
1903
  await cleanup_subscriptions_proper(services)
1894
1904
  # Cleanup task service (cancels background tasks and process pool)
1895
1905
  await services["task_service"].shutdown()
@@ -1899,6 +1909,7 @@ async def create_app():
1899
1909
  from utils.telemetry.client import cleanup_telemetry_client
1900
1910
 
1901
1911
  await cleanup_telemetry_client()
1912
+ logger.info("Application shutdown completed")
1902
1913
 
1903
1914
  return app
1904
1915
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openrag
3
- Version: 0.4.1.dev8
3
+ Version: 0.4.1.dev9
4
4
  Summary: OpenRAG is a comprehensive Retrieval-Augmented Generation platform that enables intelligent document search and AI-powered conversations.
5
5
  Classifier: Development Status :: 4 - Beta
6
6
  Classifier: Environment :: Console
@@ -1,7 +1,7 @@
1
1
  agent.py,sha256=-qMzG7qKnJKGQgpndvyouNrO-PHLKE-DM8inX4K9UTA,38828
2
2
  auth_context.py,sha256=jonB-u3o-yj_s8TeV_FGFRminOZkwd6OcQm1G6WOHAk,2246
3
3
  dependencies.py,sha256=AjysWtYBXfqf6H_JZqvLKtZZlBuoTnMWBUfCzA9Rbr8,7107
4
- main.py,sha256=-JwyzTqkf1jZ9rgxM1FmC5R4vriIjyDKaTHV5BSTGDw,70719
4
+ main.py,sha256=JOqzQ5o7eerqBfNvbN8oyiVrRfsTjg7WQDKk6e5OXZ0,71249
5
5
  session_manager.py,sha256=DOVwx7J2ZqlGLA4Jm1bdM42sDYi8lvzeW1kpRWUgQl4,10485
6
6
  api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  api/auth.py,sha256=nuwzZPW0b270ZS0UDS1Lfbqr7H3VCCgy0d9LpCAGg7g,3625
@@ -21,7 +21,7 @@ api/provider_health.py,sha256=u4gNGhEAqsQY1ml6xWzWWAOfLHDrSVYPkw1NAmBCMsI,9690
21
21
  api/provider_validation.py,sha256=54w-2qQQS9MHrgsLghpsDkCs5EQxFoUZrp_31GPK7JM,31421
22
22
  api/router.py,sha256=nOusNdc-eOMRZo6a5eqNb91oOoleYNomHTGcKuPsMmU,6229
23
23
  api/search.py,sha256=PFL2-ReVCCzJmT31IDZlFhQm3eXSPgb9LS4mnnsc_58,2010
24
- api/settings.py,sha256=E6xIWQTi5jc7m212c3-JA5sy8mjPcw8pRw9Pu7VbtnA,83691
24
+ api/settings.py,sha256=EFfjxO-aofcOFVzG7WlYvR7O4cTCNEm7gBDGe4KidXo,83656
25
25
  api/tasks.py,sha256=j3tAfpE_X4UxhiGPrgea5jkxILF6HZK9Hoy3QTFGG0g,1524
26
26
  api/upload.py,sha256=gl47Ue_d6q-YgI019lspnmPQ22PMmFch7Z9E0tsgb6U,6649
27
27
  api/v1/__init__.py,sha256=A7dLY63RcJv6ii-Xh7WgREcwXixjzOXz2w5C0LGWTCc,190
@@ -66,7 +66,7 @@ models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
66
  models/processors.py,sha256=a-f1joalfx21YhWmJS4vIRmKoLVBj1a78r5Q08nJb9k,32591
67
67
  models/tasks.py,sha256=9iINXQZxA9-hcYzG8xC_baBfLa2w6gcRPJdQHsx_Kms,1643
68
68
  models/url.py,sha256=92rsrLLyIqUErYipYz5QwUNTdHwJ2jBRV7PIVpncTyo,5764
69
- openrag-0.4.1.dev8.dist-info/licenses/LICENSE,sha256=jWcnPXkUxEinX60Yn-_zjsY9i84vz2QSb0fi53djOkg,11334
69
+ openrag-0.4.1.dev9.dist-info/licenses/LICENSE,sha256=jWcnPXkUxEinX60Yn-_zjsY9i84vz2QSb0fi53djOkg,11334
70
70
  services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
71
  services/api_key_service.py,sha256=B3yNdBBtvLjx3W3r1_CVrLktihZ4vdR_Xx8T2CbaALM,11541
72
72
  services/auth_service.py,sha256=7DTB92R_H8x4BL0x6ngvZHt5-WF4PXd2PWsWaRShqMw,22346
@@ -88,7 +88,7 @@ tui/cli.py,sha256=utCk0OtchNNHG1CYTTAOeuIp17sHuB1NIn9-GuInZdc,17982
88
88
  tui/config_fields.py,sha256=eQCVDfRQbOnTI5c6PzOZLFNYkDvb6jOL3OXGPGyPi3U,12411
89
89
  tui/main.py,sha256=CTAMzHvU_vQ5W9Qai3fUrUO82uVHInAWqAE1azOC5hc,28237
90
90
  tui/_assets/docker-compose.gpu.yml,sha256=tV8pkI3hTEk2yvpIS6m5ONavEQdmwhuqkGW8RIhQvhk,290
91
- tui/_assets/docker-compose.yml,sha256=-KFsYBNglIkJz1nI5j4HhABawO35yhiowRUHwTRnT8g,8007
91
+ tui/_assets/docker-compose.yml,sha256=V1IPmy8XobB4Sm4MEuQioGrwQ-gw3GwserTDbspd1do,7809
92
92
  tui/_assets/flows/ingestion_flow.json,sha256=mklpOLzC4TgDmK9K8W47BG8YQyazzNa6Mvkf91UC31s,495465
93
93
  tui/_assets/flows/openrag_agent.json,sha256=J9B46HAS21pRNbatgDpDtvZjhbm-OJ4FNcc5GI_7ex4,424762
94
94
  tui/_assets/flows/openrag_nudges.json,sha256=8kDz-UAfVNo0iqKCTH64Oq0v8h0bwKZsXI6Btx1nDuE,374114
@@ -144,15 +144,15 @@ utils/langflow_headers.py,sha256=GpmOiK5AS01QCDd1Pz7fxmjdTCzWtg2js_OTUQbGlak,329
144
144
  utils/langflow_utils.py,sha256=-qxpK514H0IVMLZOkyFkxm20ZQW6y-Ds_73naCoQBFQ,2942
145
145
  utils/logging_config.py,sha256=c4ejF_kA9OkUYXd2I2u7Y1I02cDqFdKylkmco8kHGmA,5270
146
146
  utils/opensearch_queries.py,sha256=rfEZL-fZiPE22oi0cON1XBIkrtSUvVV70OYuml4ewt4,1408
147
- utils/opensearch_utils.py,sha256=stllpbE0Jt7UN1sVk0CrTeKDYRyNBnEiPCke7IOrqKI,4045
147
+ utils/opensearch_utils.py,sha256=5RX01XoZvUm9HSW7H3FDMaDUHoreC86HWxncZ-2kdtM,5378
148
148
  utils/paths.py,sha256=SdNmEy15oeq2v5sgGChPLZ_MQpqlyAtpJNrrI_N8D3w,2263
149
149
  utils/version_utils.py,sha256=6Webhqo1TQV8B2vzWUlMb_nI28i1Hd5FqE-MGijYx_I,1488
150
150
  utils/telemetry/__init__.py,sha256=xoStY8hoYWnVe0B_jNthSdzRb7AxCT0rhM8ba9Q0Obg,203
151
151
  utils/telemetry/category.py,sha256=wei3V5WyUaiadYjEE5s0ys9PY0TjnebIvTykQU0P_2k,1114
152
152
  utils/telemetry/client.py,sha256=RhjW1a27w7W6gHt9X7AxdRPdZGmCEQDPskkxj5nsuiQ,12500
153
153
  utils/telemetry/message_id.py,sha256=IAu0wBVNOGPcSlQ0bAzvqIYr1Ac_n8wSTSxXzq_tiV0,9634
154
- openrag-0.4.1.dev8.dist-info/METADATA,sha256=yf9f1D85drv81h_9Ff5bg3avweo2dSVMWgOwq7oH4ws,7514
155
- openrag-0.4.1.dev8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
156
- openrag-0.4.1.dev8.dist-info/entry_points.txt,sha256=ArKNHB63I3K8vynNkogvZOLmmQFpIsHDL7MvreCmju4,45
157
- openrag-0.4.1.dev8.dist-info/top_level.txt,sha256=uOXDYvPnDHWjAKsqgz_7wX5PGLxkDN6k3g8dNZ7Nuv0,101
158
- openrag-0.4.1.dev8.dist-info/RECORD,,
154
+ openrag-0.4.1.dev9.dist-info/METADATA,sha256=COOqKVqhmyK8bJjvWzmZkyDgV2n6n4WfDH6CAgze0J0,7514
155
+ openrag-0.4.1.dev9.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
156
+ openrag-0.4.1.dev9.dist-info/entry_points.txt,sha256=ArKNHB63I3K8vynNkogvZOLmmQFpIsHDL7MvreCmju4,45
157
+ openrag-0.4.1.dev9.dist-info/top_level.txt,sha256=uOXDYvPnDHWjAKsqgz_7wX5PGLxkDN6k3g8dNZ7Nuv0,101
158
+ openrag-0.4.1.dev9.dist-info/RECORD,,
@@ -10,26 +10,20 @@ services:
10
10
  environment:
11
11
  - discovery.type=single-node
12
12
  - OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD}
13
- # Run security setup in background after OpenSearch starts
14
- command: >
15
- bash -c "
16
- # Ensure data directory has correct permissions
17
- sudo chown -R opensearch:opensearch /usr/share/opensearch/data || true
18
-
19
- # Start OpenSearch in background
20
- /usr/share/opensearch/opensearch-docker-entrypoint.sh opensearch &
21
-
22
- # Wait a bit for OpenSearch to start, then apply security config
23
- sleep 10 && /usr/share/opensearch/setup-security.sh &
24
-
25
- # Wait for background processes
26
- wait
27
- "
13
+ - OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g
28
14
  ports:
29
15
  - "9200:9200"
30
16
  - "9600:9600"
31
17
  volumes:
32
- - ${OPENSEARCH_DATA_PATH:-./opensearch-data}:/usr/share/opensearch/data:U,z
18
+ - opensearch-data:/usr/share/opensearch/data
19
+ stop_grace_period: 2m
20
+ healthcheck:
21
+ test: ["CMD-SHELL", "curl -ku admin:$$OPENSEARCH_PASSWORD 'https://localhost:9200/_cluster/health' -s | grep -qE '\"status\":\"(green|yellow)\"'"]
22
+ interval: 15s
23
+ timeout: 10s
24
+ retries: 20
25
+ start_period: 60s
26
+ restart: unless-stopped
33
27
 
34
28
  dashboards:
35
29
  image: opensearchproject/opensearch-dashboards:3.0.0
@@ -186,3 +180,6 @@ services:
186
180
  - LANGFLOW_ENABLE_SUPERUSER_CLI=${LANGFLOW_ENABLE_SUPERUSER_CLI}
187
181
  # - DEFAULT_FOLDER_NAME=OpenRAG
188
182
  - HIDE_GETTING_STARTED_PROGRESS=true
183
+
184
+ volumes:
185
+ opensearch-data:
utils/opensearch_utils.py CHANGED
@@ -121,3 +121,40 @@ async def wait_for_opensearch(
121
121
  message: str = "Failed to verify whether OpenSearch is ready."
122
122
  logger.error(message)
123
123
  raise OpenSearchNotReadyError(message)
124
+
125
+
126
+ async def graceful_opensearch_shutdown(opensearch_client: AsyncOpenSearch) -> None:
127
+ """Gracefully shutdown OpenSearch client connection.
128
+
129
+ This ensures that all pending operations are completed and connections
130
+ are properly closed before the application exits.
131
+
132
+ Args:
133
+ opensearch_client: The OpenSearch client to shutdown.
134
+ """
135
+ if opensearch_client is None:
136
+ logger.debug("OpenSearch client is None, skipping graceful shutdown")
137
+ return
138
+
139
+ try:
140
+ logger.info("Initiating graceful OpenSearch shutdown...")
141
+
142
+ # Flush any pending write operations before closing
143
+ try:
144
+ await asyncio.wait_for(
145
+ opensearch_client.indices.flush(index="_all", wait_if_ongoing=True),
146
+ timeout=10.0
147
+ )
148
+ logger.debug("Index flush completed")
149
+ except asyncio.TimeoutError:
150
+ logger.warning("Timeout during index flush")
151
+ except Exception as e:
152
+ logger.warning("Error during index flush", error=str(e))
153
+
154
+ # Close the client connection
155
+ await opensearch_client.close()
156
+ logger.info("OpenSearch client connection closed gracefully")
157
+
158
+ except Exception as e:
159
+ logger.error("Error during graceful OpenSearch shutdown", error=str(e))
160
+