Migrate infrastructure apps to centralized aitbc package utilities
- Migrate monitor/monitor.py from logging to aitbc.get_logger and hardcoded paths to DATA_DIR - Migrate multi-region-load-balancer/main.py from logging to aitbc.get_logger - Migrate global-infrastructure/main.py from logging to aitbc.get_logger - Migrate global-ai-agents/main.py from logging to aitbc.get_logger - Migrate exchange-integration/main.py from logging to aitbc.get_logger - Migrate trading-engine/main.py from logging to aitbc.get_logger - Migrate compliance-service/main.py from logging to aitbc.get_logger - Remove logging.basicConfig() calls from all files
This commit is contained in:
@@ -5,7 +5,6 @@ Handles KYC/AML, regulatory compliance, and monitoring
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Optional
|
||||
@@ -13,9 +12,9 @@ from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
from aitbc import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
|
||||
@@ -5,7 +5,6 @@ Handles real exchange connections and trading operations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Optional
|
||||
@@ -13,9 +12,9 @@ import aiohttp
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
from aitbc import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
app = FastAPI(
|
||||
title="AITBC Exchange Integration Service",
|
||||
|
||||
@@ -5,16 +5,15 @@ Handles cross-chain and cross-region AI agent communication with global optimiza
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Optional
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
from aitbc import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
app = FastAPI(
|
||||
title="AITBC Global AI Agent Communication Service",
|
||||
|
||||
@@ -5,16 +5,15 @@ Handles multi-region deployment, load balancing, and global optimization
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Optional
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
from aitbc import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
app = FastAPI(
|
||||
title="AITBC Global Infrastructure Service",
|
||||
|
||||
@@ -4,14 +4,14 @@ AITBC Monitor Service
|
||||
"""
|
||||
|
||||
import time
|
||||
import logging
|
||||
import json
|
||||
from pathlib import Path
|
||||
import psutil
|
||||
|
||||
from aitbc import get_logger, DATA_DIR
|
||||
|
||||
def main():
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger('aitbc-monitor')
|
||||
logger = get_logger('aitbc-monitor')
|
||||
|
||||
while True:
|
||||
try:
|
||||
@@ -21,14 +21,14 @@ def main():
|
||||
logger.info(f'System: CPU {cpu_percent}%, Memory {memory_percent}%')
|
||||
|
||||
# Blockchain stats
|
||||
blockchain_file = Path('/var/lib/aitbc/data/blockchain/aitbc/blockchain.json')
|
||||
blockchain_file = DATA_DIR / 'data/blockchain/aitbc/blockchain.json'
|
||||
if blockchain_file.exists():
|
||||
with open(blockchain_file, 'r') as f:
|
||||
data = json.load(f)
|
||||
logger.info(f'Blockchain: {len(data.get("blocks", []))} blocks')
|
||||
|
||||
# Marketplace stats
|
||||
marketplace_dir = Path('/var/lib/aitbc/data/marketplace')
|
||||
marketplace_dir = DATA_DIR / 'data/marketplace'
|
||||
if marketplace_dir.exists():
|
||||
listings_file = marketplace_dir / 'gpu_listings.json'
|
||||
if listings_file.exists():
|
||||
|
||||
@@ -5,16 +5,15 @@ Handles intelligent load distribution across global regions
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Optional
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
from aitbc import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
app = FastAPI(
|
||||
title="AITBC Multi-Region Load Balancer",
|
||||
|
||||
@@ -5,7 +5,6 @@ Handles order matching, trade execution, and settlement
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
from collections import defaultdict, deque
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@@ -14,9 +13,9 @@ from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
from aitbc import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
|
||||
Reference in New Issue
Block a user