How jhackisneros/examen_final works
Project Type and Purpose
• This is a Python‐based scheduling/processing tool (not a full‐stack web app).
• It reads process definitions from a JSON “database,” runs a scheduler, collects metrics, and persists or displays results.
• Entry points: lanzador.py (launcher script) and main.py.
Main Architectural Components
a. Presentation / CLI Layer
• lanzador.py – parses CLI arguments, environment variables, scheduling strategy parameters.
• main.py – orchestrates application bootstrap, service wiring (dependency injection of scheduler, repos, metrics).
b. Application / Orchestration Layer
• src/scheduler.py – core scheduling engine; implements dispatch algorithms.
• src/metrics.py – collects and formats scheduling metrics (turnaround time, waiting time, etc.).
c. Domain Layer
• src/proceso.py – domain model of a “Process” with id, arrival time, burst, priority, etc.
• src/repositorio_procesos.py – domain‐level interface for loading process lists.
d. Infrastructure / Persistence Layer
• database/json_database.py – concrete persistence adapter reading/writing procesos.json.
• src/database.py – abstract database interface for storing schedules or metrics.
• src/repositorio.py – general repository abstraction for persistence of runs/results.
e. Tests
• tests/test_proceso.py – example of unit tests against the domain model.
Relationships & Data Flow
• CLI → main → scheduler
• Scheduler → repositorio_procesos (to fetch input processes)
• Scheduler → metrics (to record scheduling events)
• Metrics → repositorio (to persist or export metrics)
• Repositorio → database adapter (JSON persistence)
• Optionally, database → repositorio_procesos (for loading)
Architectural Patterns & Principles
• Layered architecture: CLI / Application / Domain / Infrastructure
• Dependency Inversion: Scheduler and Metrics depend on repository interfaces, not concrete JSON classes.
• Single Responsibility: Each module has one clear concern (parsing, scheduling, persistence).
• Testability: Mocks can replace JSON DB for unit testing.