A CLI tool for extracting metrics from raw result files using workload-specific tools
Project description
๐ฏ Results Parser Agent
A powerful, efficient parser for extracting metrics from benchmark result files using workload-specific extraction scripts. The parser automatically analyzes result files and extracts metrics into structured JSON output with high accuracy and reliability.
๐ Features
- ๐ฏ Script-Based Parsing: Uses workload-specific extraction scripts for reliable, deterministic metric extraction
- ๐ Flexible Input: Process single files or entire directories of result files
- ๐ง Workload-Specific Tools: Dedicated extraction scripts for different benchmark types (FIO, Redis, Nginx, MariaDB/MySQL TPC-H & TPC-C) that automatically extract all available metrics
- ๐ Structured Output: Direct output in Pydantic schemas for easy integration
- ๐ ๏ธ Professional CLI: Clean, modular command-line interface with service-based architecture
- ๐ง Python API: Easy integration into existing Python applications
- ๐ Error Recovery: Robust error handling and retry mechanisms
- ๐ฆ Git-based Scripts: Secure, efficient script distribution and caching system
- ๐ Enterprise Security: SSH authentication, environment variables, and secure defaults
- ๐๏ธ Service Architecture: Modular, maintainable codebase with clear separation of concerns
๐ฆ Installation
Quick Install (Recommended)
pip install result-parser-agent
Development Install
# Clone the repository
git clone https://github.com/Infobellit-Solutions-Pvt-Ltd/result-parser-agent.git
cd result-parser-agent
# Install with uv (recommended)
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
uv pip install -e .
# Or install with pip
pip install -e .
๐ Configuration
Environment Variables
Create a .env file in your project directory:
# Script Management
SCRIPTS_BASE_URL=git@github.com:AMD-DEAE-CEME/epdw2.0_parser_scripts.git
SCRIPTS_CACHE_DIR=~/.cache/result-parser/scripts
SCRIPTS_CACHE_TTL=3600
๐ฏ Quick Start
1. Parse Results
# Parse all files in a directory with workload-specific tools
result-parser parse ./benchmark_results nginx
# Parse Redis results (scripts automatically extract all available metrics)
result-parser parse ./benchmark_results redis
# Parse a single file
result-parser parse ./results.txt fio
# Custom output file
result-parser parse ./results/ mariadb_tpch --output my_results.json
# Verbose output
result-parser parse ./results/ mysql_tpcc --verbose
2. Manage Registry
# List all available workloads in registry
result-parser registry list
# Show detailed information about a specific workload
result-parser registry show nginx
# Download workload script to cache
result-parser registry download nginx
# Add new workload to registry
result-parser registry add fio --metrics "random_read_iops,random_write_iops" --description "Storage performance benchmark"
# Update existing workload
result-parser registry update redis --metrics "SET(requests/sec),GET(requests/sec)"
3. Manage Cache
# Show cache information and statistics
result-parser cache info
# List cached workloads
result-parser cache list
# Clear specific workload cache
result-parser cache clear fio
# Clear all caches
result-parser cache clear-all
4. Show Version
# Show version information
result-parser version
๐๏ธ Service-Based Architecture
The parser now uses a modern service-based architecture for better maintainability and testability:
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ CLI Layer โ โ Service Layer โ โ Data Layer โ
โ (Typer CLI) โโโโโบโ (Business Logic)โโโโโบโ (Models) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Command Groups โ โ Core Services โ โ Pydantic โ
โ (parse, โ โ (Registry, โ โ Models โ
โ registry, โ โ Cache, โ โ (Structured โ
โ cache) โ โ Workload, โ โ Results) โ
โโโโโโโโโโโโโโโโโโโ โ Parsing) โ โโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ External โ
โ (Git, Cache, โ
โ Scripts) โ
โโโโโโโโโโโโโโโโโโโโ
Service Layer Components:
- RegistryService: Manages workload registry and metadata
- CacheService: Handles script and registry caching
- WorkloadService: Orchestrates workload operations
- ParsingService: Core parsing logic and result processing
Key Benefits:
- Modular: Clear separation of concerns
- Testable: Each service can be tested independently
- Maintainable: Easy to modify and extend
- Scalable: Services can be easily replaced or enhanced
๐ Cache-First Architecture
The CLI tool uses a cache-first approach for better performance and offline capability:
Local Cache Priority
- No API calls by default: The CLI first checks local cache for available workload scripts
- Fast startup: No network delays when using cached workloads
- Offline capability: Works without internet connection for cached workloads
- Smart downloading: Scripts are downloaded only when needed
Smart Workload Discovery
- Cache-first validation: When parsing, checks local cache first
- Auto-download: If workload not in cache, automatically downloads from registry
- Registry management: Use
registry listto see all available workloads
๐ How Metrics Extraction Works
The agent uses a two-phase approach for metrics extraction:
Phase 1: Automatic Extraction
- Scripts are self-sufficient: Each workload-specific script automatically extracts all available metrics from the data
- No user input required: You don't need to specify which metrics to extract when parsing
- Comprehensive coverage: Scripts extract all metrics they can find in the data
Phase 2: Validation & Reporting
- Expected metrics: Defined in the workload registry for validation purposes
- Automatic validation: The agent compares extracted metrics against expected metrics
- Detailed reporting: Shows missing metrics, unexpected metrics, and extraction success
Example Output
๐ Expected metrics for fio: ['random_read_iops', 'random_write_iops']
๐ Extracted metrics: random_read_iops, random_write_iops, sequential_read_mbps
โน๏ธ Additional metrics found: sequential_read_mbps
โ
All expected metrics successfully extracted!
This approach ensures maximum flexibility while maintaining quality control through validation.
๐ง Supported Workloads
The agent supports various benchmark workloads with dedicated extraction scripts:
| Workload | Description | Example Metrics |
|---|---|---|
| FIO | Storage performance benchmark | random_read_iops, random_write_iops, sequential_read_mbps |
| Redis | In-memory database benchmark | SET(requests/sec), GET(requests/sec) |
| Nginx | Web server performance | Requests/sec, Transfer/sec |
| MariaDB TPC-H | Database TPC-H benchmark | Power@Size, Throughput@Size, QphH@Size |
| MySQL TPC-H | Database TPC-H benchmark | Power@Size, Throughput@Size, QphH@Size |
| MariaDB TPC-C | Database TPC-C benchmark | tpmC, tpmTOTAL |
| MySQL TPC-C | Database TPC-C benchmark | tpmC, tpmTOTAL |
| Stream | Memory bandwidth benchmark | Triad |
| DGEMM | Matrix multiplication benchmark | GFLOPS |
| Cassandra | Database benchmark | Op rate(op/s), Read(op/s), Write(op/s) |
| HPL | High Performance Linpack | GFLOPS |
| SPEC CPU | CPU benchmark suite | SPECrate(R)2017_int_base, SPECrate(R)2017_fp_base |
| FFmpeg | Video encoding benchmark | fps, fph, avg_elapsed_time(secs) |
| LTP | Linux Test Project | Total Tests, Total Skipped Tests, Total Failures |
| SPECjbb | Java business benchmark | hbir (max attempted), max-jops, critical-jops |
๐ ๏ธ CLI Commands Reference
parse - Parse Benchmark Results
result-parser parse <input_path> <workload> [OPTIONS]
Arguments:
input_path Path to results file or directory
workload Workload type (fio, redis, nginx, etc.)
Options:
--output TEXT Output file path [default: results.json]
--verbose Enable verbose logging
--help Show this message and exit
registry - Manage Workload Registry
result-parser registry <command> [OPTIONS]
Commands:
list List all available workloads in registry
show <workload> Show detailed information about a workload
add <workload> Add a new workload to registry
update <workload> Update an existing workload
download <workload> Download workload script to cache
cache - Manage Script Cache
result-parser cache <command> [OPTIONS]
Commands:
info Show cache information and statistics
list List all cached workloads
clear [workload] Clear specific or all caches
version - Show Version
result-parser version
Shows:
- Application version
- Build information
๐ Security Features
- SSH Authentication: Secure access to private Git repositories
- Environment Variables: No hardcoded secrets or API keys
- Input Validation: Comprehensive validation of all user inputs
- Secure Defaults: Principle of least privilege in configuration
- Script Isolation: Scripts run in controlled environment
๐ Performance Features
- Script Caching: Local cache with TTL-based invalidation
- Sparse Git Operations: Efficient individual script retrieval
- Lazy Loading: Scripts downloaded only when needed
- Service Architecture: Optimized for performance and scalability
๐งช Testing
Run the comprehensive test suite to ensure everything works correctly:
# Run all tests
uv run python tests/test_functionality.py
# Run with pytest
uv run pytest
# Run with coverage
uv run pytest --cov=src/result_parser_agent
# Run specific test file
uv run pytest tests/test_functionality.py
๐ Development
Code Quality
# Format code
uv run black .
# Sort imports
uv run isort .
# Lint code
uv run ruff check .
# Type checking
uv run mypy src/
# Run all quality checks
uv run ruff check . && uv run black --check . && uv run isort --check-only .
Service Development
The codebase is organized into clear service layers:
src/result_parser_agent/services/: Core business logic servicessrc/result_parser_agent/cli/commands/: CLI command implementationssrc/result_parser_agent/models/: Pydantic data modelssrc/result_parser_agent/utils/: Utility functions and validators
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
๐ Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file result_parser_agent-2.0.1.tar.gz.
File metadata
- Download URL: result_parser_agent-2.0.1.tar.gz
- Upload date:
- Size: 69.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39445836e0f5ee93933b437a06d6231481f6986f1986856f9f54a5a9752bc20f
|
|
| MD5 |
c938c8b423a2b9548ee3a356523216f9
|
|
| BLAKE2b-256 |
6d0b7b38b19604a555a01fb4984dd208e7e254012067106f20bf42c002333b4e
|
File details
Details for the file result_parser_agent-2.0.1-py3-none-any.whl.
File metadata
- Download URL: result_parser_agent-2.0.1-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f5be96e74d87f1582a28caaf954f941665e2c5c60ca58b63e1361e04e74bb97
|
|
| MD5 |
83cd081eff6b72d16c49669a6af3d6c2
|
|
| BLAKE2b-256 |
c556c4c1aa955e475a9b04fb53cc37b09ac081e3e08933f6aadb48154033d01e
|