Skip to content

Commit aa1d1a8

Browse files
authored
Fix CogniwareIms pri-commit issues (#2400)
Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent 7befe87 commit aa1d1a8

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

CogniwareIms/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ This system uses the OPEA megaservice pattern to orchestrate multiple microservi
7777
- **Reranking Microservice**: Improve retrieval quality (BAAI/bge-reranker-base)
7878
- **DataPrep Microservice**: Document ingestion and processing
7979

80-
## Documentation
81-
82-
- [Deployment Guide](docs/DEPLOYMENT_GUIDE.md)
83-
- [Data Setup](docs/DATA_SETUP.md)
84-
- [OPEA Compliance](docs/OPEA_COMPLIANCE_SUMMARY.md)
85-
- [Contributing](docs/CONTRIBUTING.md)
86-
8780
## License
8881

8982
Apache 2.0 - See [LICENSE](LICENSE) file for details.

CogniwareIms/backend/app/services/dbqna_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Converts natural language to SQL and executes against inventory database
66
"""
77

8+
import json
89
import logging
910
import os
1011
from typing import Any, Dict, List, Optional

CogniwareIms/backend/app/services/opea_client.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Any, Dict, List, Optional
88

99
import httpx
10+
from fastapi import HTTPException
1011

1112
logger = logging.getLogger(__name__)
1213

@@ -110,10 +111,23 @@ async def health_check_all(self) -> Dict[str, str]:
110111

111112
status = {}
112113
for name, url in services.items():
113-
status[name] = await check_service(url)
114+
status[name] = await self._check_service(url)
114115

115116
return status
116117

118+
async def _check_service(self, url: str) -> str:
119+
"""Check if a service is healthy."""
120+
try:
121+
async with httpx.AsyncClient(timeout=self.timeout) as client:
122+
response = await client.get(f"{url}/health")
123+
if response.status_code == 200:
124+
return "healthy"
125+
else:
126+
return f"unhealthy (status: {response.status_code})"
127+
except Exception as e:
128+
logger.error(f"Health check failed for {url}: {e}")
129+
return f"unhealthy (error: {str(e)})"
130+
117131

118132
# Global OPEA client instance
119133
opea_client = OPEAClient()

0 commit comments

Comments
 (0)