How asi-uniovi/malloovia works
Project Type and Purpose
• Malloovia is a Python package designed to solve virtual machine allocation problems in cloud infrastructure using linear programming.
• It provides both a Python API and a CLI interface for defining and solving VM allocation problems in an IaaS context.
• The project is split into two main phases (Phase I for long term reservation decisions, and Phase II for short term VM allocations).
Main Components
• Core Library (malloovia package):
– Contains modules like cli.py (command-line interface), lpsolver.py (linear programming solver), model.py (definitions for VMs, problems, performance sets, etc.), phases.py (phase I and II solvers), solution_model.py, and util.py.
– YAML schemas (malloovia.schema.yaml and problem.schema.yaml) that define the problem and solution file formats.
• User Interfaces:
– Python API: Components/classes that users import and integrate directly into Python applications.
– CLI: Accessible via the malloovia/cli.py module, which allows execution via command-line.
• External Configuration/Deployment:
– Build and configuration files (setup.py, setup.cfg, pyproject.toml, Makefile, tox.ini, Travis CI configuration, etc.), which indicate testing, continuous integration (CI), and documentation generation.
• Documentation:
– The docs/ folder holds ReStructuredText files, templates, and a Makefile used to generate documentation via ReadTheDocs.
• Testing:
– The tests/ directory contains unit tests and test data (YAML problem and solution examples, CSV workloads) to ensure the project's reliability.
Relationships and Interactions
• User Input Flow:
– Problem definitions and workload data (possibly provided via YAML files or directly in Python) feed into the model components.
– The CLI or Python API orchestrates the execution by calling Phase I (reservation decision) followed by Phase II (on-demand allocation).
• Solver Engine:
– The lpsolver module interfaces with the problem data (constructed in model.py and phases.py) to compute the optimal VM allocation.
• Output Flow:
– After computation, the solutions are output via either a file (YAML) or returned by the API, and these may be further processed or inspected.
• Configuration and Testing:
– CI (such as Travis CI) automatically runs tests defined in the tests/ directory, ensuring the integration and reliability of all components.
Architectural Patterns and Design Principles
• Separation of Concerns:
– The package clearly separates problem modeling, CLI interaction, and the underlying solver logic.
• Layered Architecture:
– UI Layer (CLI/Python API) → Business Logic (Phases, Models, and Solver) → Configuration/Utility (schemas, utilities) → Testing & Documentation.
• Extensibility:
– With clear YAML schemas and modular design, adding new problem types, solvers, or additional features can be done with minimal impact on existing modules.