@@ -185,27 +185,42 @@ def _call_seer(
185
185
)
186
186
187
187
188
- def _generate_fixability_score (group : Group ):
188
+ def _generate_fixability_score (group : Group ) -> SummarizeIssueResponse | None :
189
189
payload = {
190
190
"group_id" : group .id ,
191
191
"organization_slug" : group .organization .slug ,
192
192
"organization_id" : group .organization .id ,
193
193
"project_id" : group .project .id ,
194
194
}
195
195
196
- if in_random_rollout ("issues.fixability.gpu-rollout-rate" ):
196
+ use_gpu = in_random_rollout ("issues.fixability.gpu-rollout-rate" )
197
+ if use_gpu :
197
198
connection_pool = fixability_connection_pool_gpu
198
199
else :
199
200
connection_pool = fixability_connection_pool
200
201
201
- response = make_signed_seer_api_request (
202
- connection_pool ,
203
- "/v1/automation/summarize/fixability" ,
204
- body = orjson .dumps (payload , option = orjson .OPT_NON_STR_KEYS ),
205
- timeout = settings .SEER_FIXABILITY_TIMEOUT ,
206
- )
202
+ # TODO(kddubey): rm this handling once we verify that the GPU deployment works
203
+ try :
204
+ response = make_signed_seer_api_request (
205
+ connection_pool ,
206
+ "/v1/automation/summarize/fixability" ,
207
+ body = orjson .dumps (payload , option = orjson .OPT_NON_STR_KEYS ),
208
+ timeout = settings .SEER_FIXABILITY_TIMEOUT ,
209
+ )
210
+ except Exception :
211
+ if not use_gpu :
212
+ raise
213
+ else :
214
+ logger .warning ("GPU fixability connection failed" , exc_info = True )
215
+ return None
216
+
207
217
if response .status >= 400 :
208
- raise Exception (f"Seer API error: { response .status } " )
218
+ if not use_gpu :
219
+ raise Exception (f"Seer API error: { response .status } " )
220
+ else :
221
+ logger .warning ("GPU fixability endpoint failed" , extra = {"status" : response .status })
222
+ return None
223
+
209
224
response_data = orjson .loads (response .data )
210
225
return SummarizeIssueResponse .validate (response_data )
211
226
@@ -302,6 +317,9 @@ def _run_automation(
302
317
with sentry_sdk .start_span (op = "ai_summary.generate_fixability_score" ):
303
318
issue_summary = _generate_fixability_score (group )
304
319
320
+ if not issue_summary :
321
+ return
322
+
305
323
if not issue_summary .scores :
306
324
raise ValueError ("Issue summary scores is None or empty." )
307
325
if issue_summary .scores .fixability_score is None :
0 commit comments