Files
serv_benchmark/backend/app/models/benchmark.py
gilles soulier c6a8e8e83d feat: Complete MVP implementation of Linux BenchTools
 Features:
- Backend FastAPI complete (25 Python files)
  - 5 SQLAlchemy models (Device, HardwareSnapshot, Benchmark, Link, Document)
  - Pydantic schemas for validation
  - 4 API routers (benchmark, devices, links, docs)
  - Authentication with Bearer token
  - Automatic score calculation
  - File upload support

- Frontend web interface (13 files)
  - 4 HTML pages (Dashboard, Devices, Device Detail, Settings)
  - 7 JavaScript modules
  - Monokai dark theme CSS
  - Responsive design
  - Complete CRUD operations

- Client benchmark script (500+ lines Bash)
  - Hardware auto-detection
  - CPU, RAM, Disk, Network benchmarks
  - JSON payload generation
  - Robust error handling

- Docker deployment
  - Optimized Dockerfile
  - docker-compose with 2 services
  - Persistent volumes
  - Environment variables

- Documentation & Installation
  - Automated install.sh script
  - README, QUICKSTART, DEPLOYMENT guides
  - Complete API documentation
  - Project structure documentation

📊 Stats:
- ~60 files created
- ~5000 lines of code
- Full MVP feature set implemented

🚀 Ready for production deployment!

🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 14:46:10 +01:00

41 lines
1.5 KiB
Python

"""
Linux BenchTools - Benchmark Model
"""
from sqlalchemy import Column, Integer, Float, DateTime, String, Text, ForeignKey
from sqlalchemy.orm import relationship
from datetime import datetime
from app.db.base import Base
class Benchmark(Base):
"""
Benchmark run results
"""
__tablename__ = "benchmarks"
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
device_id = Column(Integer, ForeignKey("devices.id"), nullable=False, index=True)
hardware_snapshot_id = Column(Integer, ForeignKey("hardware_snapshots.id"), nullable=False)
run_at = Column(DateTime, nullable=False, default=datetime.utcnow, index=True)
bench_script_version = Column(String(50), nullable=False)
# Scores
global_score = Column(Float, nullable=False)
cpu_score = Column(Float, nullable=True)
memory_score = Column(Float, nullable=True)
disk_score = Column(Float, nullable=True)
network_score = Column(Float, nullable=True)
gpu_score = Column(Float, nullable=True)
# Details
details_json = Column(Text, nullable=False) # JSON object with all raw results
notes = Column(Text, nullable=True)
# Relationships
device = relationship("Device", back_populates="benchmarks")
hardware_snapshot = relationship("HardwareSnapshot", back_populates="benchmarks")
def __repr__(self):
return f"<Benchmark(id={self.id}, device_id={self.device_id}, global_score={self.global_score}, run_at='{self.run_at}')>"