✨ 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>
80 lines
3.1 KiB
Python
80 lines
3.1 KiB
Python
"""
|
|
Linux BenchTools - Hardware Snapshot Model
|
|
"""
|
|
|
|
from sqlalchemy import Column, Integer, String, Float, Boolean, DateTime, Text, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime
|
|
from app.db.base import Base
|
|
|
|
|
|
class HardwareSnapshot(Base):
|
|
"""
|
|
Hardware configuration snapshot at the time of a benchmark
|
|
"""
|
|
__tablename__ = "hardware_snapshots"
|
|
|
|
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
|
|
device_id = Column(Integer, ForeignKey("devices.id"), nullable=False, index=True)
|
|
captured_at = Column(DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
# CPU
|
|
cpu_vendor = Column(String(100), nullable=True)
|
|
cpu_model = Column(String(255), nullable=True)
|
|
cpu_microarchitecture = Column(String(100), nullable=True)
|
|
cpu_cores = Column(Integer, nullable=True)
|
|
cpu_threads = Column(Integer, nullable=True)
|
|
cpu_base_freq_ghz = Column(Float, nullable=True)
|
|
cpu_max_freq_ghz = Column(Float, nullable=True)
|
|
cpu_cache_l1_kb = Column(Integer, nullable=True)
|
|
cpu_cache_l2_kb = Column(Integer, nullable=True)
|
|
cpu_cache_l3_kb = Column(Integer, nullable=True)
|
|
cpu_flags = Column(Text, nullable=True) # JSON array
|
|
cpu_tdp_w = Column(Float, nullable=True)
|
|
|
|
# RAM
|
|
ram_total_mb = Column(Integer, nullable=True)
|
|
ram_slots_total = Column(Integer, nullable=True)
|
|
ram_slots_used = Column(Integer, nullable=True)
|
|
ram_ecc = Column(Boolean, nullable=True)
|
|
ram_layout_json = Column(Text, nullable=True) # JSON array
|
|
|
|
# GPU
|
|
gpu_summary = Column(Text, nullable=True)
|
|
gpu_vendor = Column(String(100), nullable=True)
|
|
gpu_model = Column(String(255), nullable=True)
|
|
gpu_driver_version = Column(String(100), nullable=True)
|
|
gpu_memory_dedicated_mb = Column(Integer, nullable=True)
|
|
gpu_memory_shared_mb = Column(Integer, nullable=True)
|
|
gpu_api_support = Column(Text, nullable=True)
|
|
|
|
# Storage
|
|
storage_summary = Column(Text, nullable=True)
|
|
storage_devices_json = Column(Text, nullable=True) # JSON array
|
|
partitions_json = Column(Text, nullable=True) # JSON array
|
|
|
|
# Network
|
|
network_interfaces_json = Column(Text, nullable=True) # JSON array
|
|
|
|
# OS / Motherboard
|
|
os_name = Column(String(100), nullable=True)
|
|
os_version = Column(String(100), nullable=True)
|
|
kernel_version = Column(String(100), nullable=True)
|
|
architecture = Column(String(50), nullable=True)
|
|
virtualization_type = Column(String(50), nullable=True)
|
|
motherboard_vendor = Column(String(100), nullable=True)
|
|
motherboard_model = Column(String(255), nullable=True)
|
|
bios_version = Column(String(100), nullable=True)
|
|
bios_date = Column(String(50), nullable=True)
|
|
|
|
# Misc
|
|
sensors_json = Column(Text, nullable=True) # JSON object
|
|
raw_info_json = Column(Text, nullable=True) # JSON object
|
|
|
|
# Relationships
|
|
device = relationship("Device", back_populates="hardware_snapshots")
|
|
benchmarks = relationship("Benchmark", back_populates="hardware_snapshot")
|
|
|
|
def __repr__(self):
|
|
return f"<HardwareSnapshot(id={self.id}, device_id={self.device_id}, captured_at='{self.captured_at}')>"
|