ragaai-catalyst 2.2.4.1b7__py3-none-any.whl → 2.2.4.1b9__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.
- ragaai_catalyst/tracers/agentic_tracing/upload/session_manager.py +27 -3
- ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py +10 -9
- ragaai_catalyst/tracers/agentic_tracing/upload/upload_code.py +9 -8
- {ragaai_catalyst-2.2.4.1b7.dist-info → ragaai_catalyst-2.2.4.1b9.dist-info}/METADATA +1 -1
- {ragaai_catalyst-2.2.4.1b7.dist-info → ragaai_catalyst-2.2.4.1b9.dist-info}/RECORD +8 -8
- {ragaai_catalyst-2.2.4.1b7.dist-info → ragaai_catalyst-2.2.4.1b9.dist-info}/WHEEL +0 -0
- {ragaai_catalyst-2.2.4.1b7.dist-info → ragaai_catalyst-2.2.4.1b9.dist-info}/licenses/LICENSE +0 -0
- {ragaai_catalyst-2.2.4.1b7.dist-info → ragaai_catalyst-2.2.4.1b9.dist-info}/top_level.txt +0 -0
@@ -6,6 +6,7 @@ from requests.adapters import HTTPAdapter
|
|
6
6
|
from urllib3.util.retry import Retry
|
7
7
|
from urllib3.exceptions import PoolError, MaxRetryError, NewConnectionError
|
8
8
|
from requests.exceptions import ConnectionError, Timeout
|
9
|
+
from http.client import RemoteDisconnected
|
9
10
|
from ragaai_catalyst import RagaAICatalyst
|
10
11
|
import requests
|
11
12
|
|
@@ -92,11 +93,11 @@ class SessionManager:
|
|
92
93
|
for i in range(num_connections):
|
93
94
|
try:
|
94
95
|
# Make a lightweight HEAD request to the healthcheck endpoint to warm up the connection
|
95
|
-
response = self._session.head(healthcheck_url, timeout=
|
96
|
+
response = self._session.head(healthcheck_url, timeout=10)
|
96
97
|
logger.info(f"Warmup connection {i+1}: Status {response.status_code}")
|
97
98
|
except Exception as e:
|
98
|
-
logger.
|
99
|
-
# Ignore failures during warmup as they're expected
|
99
|
+
logger.warning(f"Warmup connection {i+1} failed (this may be normal): {e}")
|
100
|
+
# Ignore other failures during warmup as they're expected
|
100
101
|
continue
|
101
102
|
|
102
103
|
logger.info("Connection pool warmup completed")
|
@@ -118,6 +119,8 @@ class SessionManager:
|
|
118
119
|
logger.error(f"Connection pool exhausted during {operation_name}: {e}")
|
119
120
|
elif isinstance(e, NewConnectionError):
|
120
121
|
logger.error(f"Failed to establish new connection during {operation_name}: {e}")
|
122
|
+
elif isinstance(e, RemoteDisconnected):
|
123
|
+
logger.error(f"Remote connection closed unexpectedly during {operation_name}: {e}")
|
121
124
|
elif isinstance(e, ConnectionError):
|
122
125
|
logger.error(f"Connection error during {operation_name}: {e}")
|
123
126
|
elif isinstance(e, Timeout):
|
@@ -125,6 +128,27 @@ class SessionManager:
|
|
125
128
|
else:
|
126
129
|
logger.error(f"Unexpected error during {operation_name}: {e}")
|
127
130
|
|
131
|
+
def make_request_with_retry(self, method, url, **kwargs):
|
132
|
+
"""
|
133
|
+
Make HTTP request with additional retry logic for RemoteDisconnected errors
|
134
|
+
that may not be caught by urllib3's retry mechanism.
|
135
|
+
"""
|
136
|
+
max_retries = 3
|
137
|
+
for attempt in range(max_retries):
|
138
|
+
try:
|
139
|
+
response = self._session.request(method, url, **kwargs)
|
140
|
+
return response
|
141
|
+
except (RemoteDisconnected, ConnectionError) as e:
|
142
|
+
logger.warning(f"Connection error on attempt {attempt + 1}/{max_retries}: {e}")
|
143
|
+
if attempt == max_retries - 1:
|
144
|
+
# Re-raise the exception on the last attempt
|
145
|
+
raise
|
146
|
+
# Wait before retrying (exponential backoff)
|
147
|
+
import time
|
148
|
+
wait_time = 2 ** attempt
|
149
|
+
logger.info(f"Retrying in {wait_time} seconds...")
|
150
|
+
time.sleep(wait_time)
|
151
|
+
|
128
152
|
|
129
153
|
# Global session manager instance
|
130
154
|
logger.info("Creating global SessionManager instance")
|
@@ -6,6 +6,7 @@ import time
|
|
6
6
|
from urllib.parse import urlparse, urlunparse
|
7
7
|
from urllib3.exceptions import PoolError, MaxRetryError, NewConnectionError
|
8
8
|
from requests.exceptions import ConnectionError, Timeout, RequestException
|
9
|
+
from http.client import RemoteDisconnected
|
9
10
|
from .session_manager import session_manager
|
10
11
|
|
11
12
|
import requests
|
@@ -51,7 +52,7 @@ class UploadAgenticTraces:
|
|
51
52
|
start_time = time.time()
|
52
53
|
endpoint = f"{self.base_url}/v1/llm/presigned-url"
|
53
54
|
# Changed to POST from GET
|
54
|
-
response = session_manager.
|
55
|
+
response = session_manager.make_request_with_retry(
|
55
56
|
"POST", endpoint, headers=headers, data=payload, timeout=self.timeout
|
56
57
|
)
|
57
58
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -65,7 +66,7 @@ class UploadAgenticTraces:
|
|
65
66
|
return presignedurl
|
66
67
|
else:
|
67
68
|
# If POST fails, try GET
|
68
|
-
response = session_manager.
|
69
|
+
response = session_manager.make_request_with_retry(
|
69
70
|
"GET", endpoint, headers=headers, data=payload, timeout=self.timeout
|
70
71
|
)
|
71
72
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -86,7 +87,7 @@ class UploadAgenticTraces:
|
|
86
87
|
"Authorization": f"Bearer {token}",
|
87
88
|
"X-Project-Name": self.project_name,
|
88
89
|
}
|
89
|
-
response = session_manager.
|
90
|
+
response = session_manager.make_request_with_retry(
|
90
91
|
"POST",
|
91
92
|
endpoint,
|
92
93
|
headers=headers,
|
@@ -113,7 +114,7 @@ class UploadAgenticTraces:
|
|
113
114
|
f"Error while getting presigned url: {response.json()['message']}"
|
114
115
|
)
|
115
116
|
return None
|
116
|
-
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout) as e:
|
117
|
+
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout, RemoteDisconnected) as e:
|
117
118
|
session_manager.handle_request_exceptions(e, "getting presigned URL")
|
118
119
|
return None
|
119
120
|
except RequestException as e:
|
@@ -152,7 +153,7 @@ class UploadAgenticTraces:
|
|
152
153
|
return False
|
153
154
|
try:
|
154
155
|
start_time = time.time()
|
155
|
-
response = session_manager.
|
156
|
+
response = session_manager.make_request_with_retry(
|
156
157
|
"PUT", presignedUrl, headers=headers, data=payload, timeout=self.timeout
|
157
158
|
)
|
158
159
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -162,7 +163,7 @@ class UploadAgenticTraces:
|
|
162
163
|
if response.status_code != 200 or response.status_code != 201:
|
163
164
|
return response, response.status_code
|
164
165
|
return True
|
165
|
-
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout) as e:
|
166
|
+
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout, RemoteDisconnected) as e:
|
166
167
|
session_manager.handle_request_exceptions(e, "uploading trace to presigned URL")
|
167
168
|
return False
|
168
169
|
except RequestException as e:
|
@@ -185,7 +186,7 @@ class UploadAgenticTraces:
|
|
185
186
|
try:
|
186
187
|
start_time = time.time()
|
187
188
|
endpoint = f"{self.base_url}/v1/llm/insert/trace"
|
188
|
-
response = session_manager.
|
189
|
+
response = session_manager.make_request_with_retry(
|
189
190
|
"POST", endpoint, headers=headers, data=payload, timeout=self.timeout
|
190
191
|
)
|
191
192
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -203,7 +204,7 @@ class UploadAgenticTraces:
|
|
203
204
|
"Content-Type": "application/json",
|
204
205
|
"X-Project-Name": self.project_name,
|
205
206
|
}
|
206
|
-
response = session_manager.
|
207
|
+
response = session_manager.make_request_with_retry(
|
207
208
|
"POST",
|
208
209
|
endpoint,
|
209
210
|
headers=headers,
|
@@ -223,7 +224,7 @@ class UploadAgenticTraces:
|
|
223
224
|
else:
|
224
225
|
logger.error(f"Error while inserting traces: {response.json()['message']}")
|
225
226
|
return False
|
226
|
-
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout) as e:
|
227
|
+
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout, RemoteDisconnected) as e:
|
227
228
|
session_manager.handle_request_exceptions(e, "inserting traces")
|
228
229
|
return False
|
229
230
|
except RequestException as e:
|
@@ -6,6 +6,7 @@ import json
|
|
6
6
|
from urllib.parse import urlparse, urlunparse
|
7
7
|
from urllib3.exceptions import PoolError, MaxRetryError, NewConnectionError
|
8
8
|
from requests.exceptions import ConnectionError, Timeout, RequestException
|
9
|
+
from http.client import RemoteDisconnected
|
9
10
|
|
10
11
|
import requests
|
11
12
|
|
@@ -71,7 +72,7 @@ def _fetch_dataset_code_hashes(project_name, dataset_name, base_url=None, timeou
|
|
71
72
|
url_base = base_url if base_url is not None else RagaAICatalyst.BASE_URL
|
72
73
|
start_time = time.time()
|
73
74
|
endpoint = f"{url_base}/v2/llm/dataset/code?datasetName={dataset_name}"
|
74
|
-
response = session_manager.
|
75
|
+
response = session_manager.make_request_with_retry(
|
75
76
|
"GET", endpoint, headers=headers, data=payload, timeout=timeout
|
76
77
|
)
|
77
78
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -88,7 +89,7 @@ def _fetch_dataset_code_hashes(project_name, dataset_name, base_url=None, timeou
|
|
88
89
|
"Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
|
89
90
|
"X-Project-Name": project_name,
|
90
91
|
}
|
91
|
-
response = session_manager.
|
92
|
+
response = session_manager.make_request_with_retry(
|
92
93
|
"GET", endpoint, headers=headers, data=payload, timeout=timeout
|
93
94
|
)
|
94
95
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -101,7 +102,7 @@ def _fetch_dataset_code_hashes(project_name, dataset_name, base_url=None, timeou
|
|
101
102
|
else:
|
102
103
|
logger.error(f"Error while fetching dataset code hashes: {response.json()['message']}")
|
103
104
|
return None
|
104
|
-
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout) as e:
|
105
|
+
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout, RemoteDisconnected) as e:
|
105
106
|
session_manager.handle_request_exceptions(e, "fetching dataset code hashes")
|
106
107
|
return None
|
107
108
|
except RequestException as e:
|
@@ -213,7 +214,7 @@ def _put_zip_presigned_url(project_name, presignedUrl, filename, timeout=120):
|
|
213
214
|
payload = f.read()
|
214
215
|
|
215
216
|
start_time = time.time()
|
216
|
-
response = session_manager.
|
217
|
+
response = session_manager.make_request_with_retry(
|
217
218
|
"PUT", presignedUrl, headers=headers, data=payload, timeout=timeout
|
218
219
|
)
|
219
220
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -223,7 +224,7 @@ def _put_zip_presigned_url(project_name, presignedUrl, filename, timeout=120):
|
|
223
224
|
if response.status_code not in [200, 201]:
|
224
225
|
return response, response.status_code
|
225
226
|
return True
|
226
|
-
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout) as e:
|
227
|
+
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout, RemoteDisconnected) as e:
|
227
228
|
session_manager.handle_request_exceptions(e, "uploading zip to presigned URL")
|
228
229
|
return False
|
229
230
|
except RequestException as e:
|
@@ -251,7 +252,7 @@ def _insert_code(
|
|
251
252
|
url_base = base_url if base_url is not None else RagaAICatalyst.BASE_URL
|
252
253
|
start_time = time.time()
|
253
254
|
endpoint = f"{url_base}/v2/llm/dataset/code"
|
254
|
-
response = session_manager.
|
255
|
+
response = session_manager.make_request_with_retry(
|
255
256
|
"POST", endpoint, headers=headers, data=payload, timeout=timeout
|
256
257
|
)
|
257
258
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -269,7 +270,7 @@ def _insert_code(
|
|
269
270
|
"Content-Type": "application/json",
|
270
271
|
"Authorization": f"Bearer {token}",
|
271
272
|
}
|
272
|
-
response = session_manager.
|
273
|
+
response = session_manager.make_request_with_retry(
|
273
274
|
"POST", endpoint, headers=headers, data=payload, timeout=timeout
|
274
275
|
)
|
275
276
|
elapsed_ms = (time.time() - start_time) * 1000
|
@@ -285,7 +286,7 @@ def _insert_code(
|
|
285
286
|
else:
|
286
287
|
logger.error(f"Failed to insert code: {response.json()['message']}")
|
287
288
|
return None
|
288
|
-
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout) as e:
|
289
|
+
except (PoolError, MaxRetryError, NewConnectionError, ConnectionError, Timeout, RemoteDisconnected) as e:
|
289
290
|
session_manager.handle_request_exceptions(e, "inserting code")
|
290
291
|
return None
|
291
292
|
except RequestException as e:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.2.4.
|
3
|
+
Version: 2.2.4.1b9
|
4
4
|
Summary: RAGA AI CATALYST
|
5
5
|
Author-email: Kiran Scaria <kiran.scaria@raga.ai>, Kedar Gaikwad <kedar.gaikwad@raga.ai>, Dushyant Mahajan <dushyant.mahajan@raga.ai>, Siddhartha Kosti <siddhartha.kosti@raga.ai>, Ritika Goel <ritika.goel@raga.ai>, Vijay Chaurasia <vijay.chaurasia@raga.ai>, Tushar Kumar <tushar.kumar@raga.ai>, Rishabh Pandey <rishabh.pandey@raga.ai>, Jyotsana C G <jyotsana@raga.ai>
|
6
6
|
Requires-Python: <=3.13.2,>=3.10
|
@@ -54,10 +54,10 @@ ragaai_catalyst/tracers/agentic_tracing/tracers/network_tracer.py,sha256=m8CxYkl
|
|
54
54
|
ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py,sha256=xxrliKPfdfbIZRZqMnUewsaTD8_Hv0dbuoBivNZGD4U,21674
|
55
55
|
ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py,sha256=bhSUhNQCuJXKjgJAXhjKEYjnHMpYN90FSZdR84fNIKU,4614
|
56
56
|
ragaai_catalyst/tracers/agentic_tracing/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
|
-
ragaai_catalyst/tracers/agentic_tracing/upload/session_manager.py,sha256=
|
57
|
+
ragaai_catalyst/tracers/agentic_tracing/upload/session_manager.py,sha256=sOlxeIYIP8tycaTtZC9xkZosi6EDJUxvDw0_rc_NLI8,6823
|
58
58
|
ragaai_catalyst/tracers/agentic_tracing/upload/trace_uploader.py,sha256=Ujbu0KDl7oDr-cFtLwrQK_i7ghMuPV92mFnRfobJ1aI,24822
|
59
|
-
ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py,sha256=
|
60
|
-
ragaai_catalyst/tracers/agentic_tracing/upload/upload_code.py,sha256=
|
59
|
+
ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py,sha256=0u4GWgqtaBz9cnr_KuqVIWDvhHWkgTAOTtiy0w8RPuk,13017
|
60
|
+
ragaai_catalyst/tracers/agentic_tracing/upload/upload_code.py,sha256=CbTx2vBAPIat5bdIClv9szOo4i33YL_1v04mkUjNG2c,12170
|
61
61
|
ragaai_catalyst/tracers/agentic_tracing/upload/upload_local_metric.py,sha256=m1O8lKpxKwtHofXLW3fTHX5yfqDW5GxoveARlg5cTw4,2571
|
62
62
|
ragaai_catalyst/tracers/agentic_tracing/utils/__init__.py,sha256=XdB3X_ufe4RVvGorxSqAiB9dYv4UD7Hvvuw3bsDUppY,60
|
63
63
|
ragaai_catalyst/tracers/agentic_tracing/utils/api_utils.py,sha256=ZduFA7MmTnWfQ2FzSD0hxMAAfNNTgBs4CXcHZdXJv6k,749
|
@@ -89,8 +89,8 @@ ragaai_catalyst/tracers/utils/rag_extraction_logic_final.py,sha256=3ygkRT__lLDRf
|
|
89
89
|
ragaai_catalyst/tracers/utils/rag_trace_json_converter.py,sha256=54IEZO-YRjUAahV5nw8KClXqTF1LhfDry_TsZ4KGow4,20467
|
90
90
|
ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=-HZVmijeUFLO7e9OAvi1RJdWVTxPRUHPd1MkKQlCD54,11785
|
91
91
|
ragaai_catalyst/tracers/utils/utils.py,sha256=o-p9n2ZuophdrV0wrixu-BqRHCkovup_klc3mS8mU8g,2374
|
92
|
-
ragaai_catalyst-2.2.4.
|
93
|
-
ragaai_catalyst-2.2.4.
|
94
|
-
ragaai_catalyst-2.2.4.
|
95
|
-
ragaai_catalyst-2.2.4.
|
96
|
-
ragaai_catalyst-2.2.4.
|
92
|
+
ragaai_catalyst-2.2.4.1b9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
93
|
+
ragaai_catalyst-2.2.4.1b9.dist-info/METADATA,sha256=ox1pbQ-3DNbMms9uReLZjUKdze0ztGZ2SeDehc1TROI,17681
|
94
|
+
ragaai_catalyst-2.2.4.1b9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
95
|
+
ragaai_catalyst-2.2.4.1b9.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
|
96
|
+
ragaai_catalyst-2.2.4.1b9.dist-info/RECORD,,
|
File without changes
|
{ragaai_catalyst-2.2.4.1b7.dist-info → ragaai_catalyst-2.2.4.1b9.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|