Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions src/app/endpoints/a2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,15 @@ async def execute(
context, task_updater, task_id, context_id
)
except Exception as e: # pylint: disable=broad-exception-caught
logger.error("Error handling A2A request: %s", e, exc_info=True)
logger.exception("Error handling A2A request")
try:
await task_updater.update_status(
TaskState.failed,
message=new_agent_text_message(str(e)),
final=True,
)
except Exception as enqueue_error: # pylint: disable=broad-exception-caught
logger.error(
"Failed to publish failure event: %s", enqueue_error, exc_info=True
)
except Exception: # pylint: disable=broad-exception-caught
logger.exception("Failed to publish failure event")

async def _process_task_streaming( # pylint: disable=too-many-locals
self,
Expand Down Expand Up @@ -333,11 +331,7 @@ async def _process_task_streaming( # pylint: disable=too-many-locals
f"Unable to connect to Llama Stack backend service: {str(e)}. "
"The service may be temporarily unavailable. Please try again later."
)
logger.error(
"APIConnectionError in A2A request: %s",
str(e),
exc_info=True,
)
logger.error("APIConnectionError in A2A request: %s", str(e))
await task_updater.update_status(
TaskState.failed,
message=new_agent_text_message(
Expand Down Expand Up @@ -643,8 +637,8 @@ async def get_agent_card( # pylint: disable=unused-argument
"Agent Card capabilities: streaming=%s", agent_card.capabilities.streaming
)
return agent_card
except Exception as exc:
logger.error("Error serving A2A Agent Card: %s", str(exc))
except Exception:
logger.exception("Error serving A2A Agent Card")
raise


Expand Down Expand Up @@ -736,8 +730,8 @@ async def handle_a2a_jsonrpc( # pylint: disable=too-many-locals,too-many-statem
logger.warning(
"Could not parse A2A request body for method detection: %s", str(e)
)
except Exception as e: # pylint: disable=broad-except
logger.error("Error detecting streaming request: %s", str(e))
except Exception: # pylint: disable=broad-except
logger.exception("Error detecting streaming request")

# Setup scope for A2A app
scope = dict(request.scope)
Expand Down Expand Up @@ -781,10 +775,8 @@ async def run_a2a_app() -> None:
logger.debug("Streaming: Starting A2A app execution")
await a2a_app(scope, receive, streaming_send)
logger.debug("Streaming: A2A app execution completed")
except Exception as exc: # pylint: disable=broad-except
logger.error(
"Error in A2A app during streaming: %s", str(exc), exc_info=True
)
except Exception: # pylint: disable=broad-except
logger.exception("Error in A2A app during streaming")
await chunk_queue.put(None) # Signal end even on error

# Start the A2A app task
Expand Down
10 changes: 5 additions & 5 deletions src/authentication/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def _get_cluster_id(cls) -> str:
logger.error("API exception during ClusterInfo: %s", e)
raise ClusterIDUnavailableError("Failed to get cluster ID") from e
except Exception as e:
logger.error("Unexpected error during getting cluster ID: %s", e)
logger.exception("Unexpected error during getting cluster ID")
raise ClusterIDUnavailableError("Failed to get cluster ID") from e

@classmethod
Expand Down Expand Up @@ -227,7 +227,7 @@ def get_user_info(token: str) -> Optional[kubernetes.client.V1TokenReview]:
try:
auth_api = K8sClientSingleton.get_authn_api()
except Exception as e:
logger.error("Failed to get Kubernetes authentication API: %s", e)
logger.exception("Failed to get Kubernetes authentication API")
response = ServiceUnavailableResponse(
backend_name="Kubernetes API",
cause="Unable to initialize Kubernetes client",
Expand All @@ -242,8 +242,8 @@ def get_user_info(token: str) -> Optional[kubernetes.client.V1TokenReview]:
if response.status.authenticated:
return response.status
return None
except Exception as e: # pylint: disable=broad-exception-caught
logger.error("API exception during TokenReview: %s", e)
except Exception: # pylint: disable=broad-exception-caught
logger.exception("API exception during TokenReview")
return None


Expand Down Expand Up @@ -332,7 +332,7 @@ async def __call__(self, request: Request) -> tuple[str, str, bool, str]:
response = authorization_api.create_subject_access_review(sar)

except Exception as e:
logger.error("API exception during SubjectAccessReview: %s", e)
logger.exception("API exception during SubjectAccessReview")
response = ServiceUnavailableResponse(
backend_name="Kubernetes API",
cause="Unable to perform authorization check",
Expand Down
4 changes: 2 additions & 2 deletions src/lightspeed_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def main() -> None:
configuration.configuration.dump()
logger.info("Configuration dumped to configuration.json")
except Exception as e:
logger.error("Failed to dump configuration: %s", e)
logger.exception("Failed to dump configuration")
raise SystemExit(1) from e
return

Expand All @@ -145,7 +145,7 @@ def main() -> None:
schema_dumper.dump_schema("schema.json")
logger.info("Configuration schema dumped to schema.json")
except Exception as e:
logger.error("Failed to dump configuration schema: %s", e)
logger.exception("Failed to dump configuration schema")
raise SystemExit(1) from e
return

Expand Down
8 changes: 4 additions & 4 deletions src/runners/quota_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def quota_scheduler(config: QuotaHandlersConfiguration) -> bool:
quota_revocation(
connection, limiter, increase_quota_statement, reset_quota_statement
)
except Exception as e: # pylint: disable=broad-exception-caught
logger.error("Quota revoke error: %s", e)
except Exception: # pylint: disable=broad-exception-caught
logger.exception("Quota revoke error")
logger.info("Quota scheduler sync finished")
sleep(period)
# unreachable code
Expand All @@ -136,8 +136,8 @@ def connected(connection: Any) -> bool:
cursor.close()
logger.info("Connection to storage is ok")
return True
except Exception as e: # pylint: disable=broad-exception-caught
logger.error("Disconnected from storage: %s", e)
except Exception: # pylint: disable=broad-exception-caught
logger.exception("Disconnected from storage")
return False


Expand Down
Loading