- Implemented HTML pages for datasets, models, training, testing, and results. - Created API endpoints for managing repositories, results, tests, and training sessions. - Added functionality for streaming training progress via Server-Sent Events (SSE). - Introduced a Dockerfile for the ML runner with necessary dependencies. - Developed an SDK for user code execution within the runner container. - Enhanced CSS styles for improved UI layout and navigation. - Established a layout template for consistent HTML structure across pages. - Added JavaScript for dynamic interactions on the models page. - Implemented WebSocket handling for real-time communication with kiosk devices and controllers. - Implemented model registration and management API at /api/models - Added Gitea proxy API for repository interactions at /api/repos - Created results API for listing and comparing training results at /api/results - Developed training management API for enqueueing and retrieving training jobs at /api/trainings - Introduced SSE endpoint for live training progress updates - Added HTML pages for models, datasets, and training management - Created a Dockerfile for the ML runner with necessary dependencies - Developed SDK for user code execution within the runner container - Enhanced CSS styles for improved UI/UX - Implemented WebSocket communication for real-time device and controller interactions in the kiosk system
30 lines
650 B
Python
30 lines
650 B
Python
"""Client Redis asincrono (redis-py asyncio). Singleton semplice."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
import redis.asyncio as redis
|
|
|
|
from core.config import settings
|
|
|
|
_client: Optional[redis.Redis] = None
|
|
|
|
|
|
def client() -> redis.Redis:
|
|
global _client
|
|
if _client is None:
|
|
_client = redis.Redis(
|
|
host=settings.redis_host,
|
|
port=settings.redis_port,
|
|
decode_responses=True,
|
|
health_check_interval=30,
|
|
)
|
|
return _client
|
|
|
|
|
|
async def close() -> None:
|
|
global _client
|
|
if _client is not None:
|
|
await _client.aclose()
|
|
_client = None
|