Skip to content

Final commit of scheduler module into openvair#302

Open
rustamhse wants to merge 7 commits intoAerodisk:mainfrom
miem-project-2259:feature/scheduler-final-branch
Open

Final commit of scheduler module into openvair#302
rustamhse wants to merge 7 commits intoAerodisk:mainfrom
miem-project-2259:feature/scheduler-final-branch

Conversation

@rustamhse
Copy link
Copy Markdown

🚀 Description

This Merge Request introduces the Scheduler module to the OpenVair platform. It provides a centralized, robust, and safe mechanism for scheduling, managing, and monitoring periodic tasks (cron jobs) across the system.
By integrating directly with the host operating system's crontab, it allows users to automate background processes seamlessly via the OpenVair API/UI, while ensuring the database state always remains in sync with the actual OS.

✨ Key Features

Full CRUD Operations: Create, Read (List/Single), Update, and Delete scheduled jobs. It securely modifies the system crontab using the python-crontab library and includes a background monitoring task (@periodic_task) that periodically parses the OS crontab, synchronizes the last_run and next_run timestamps, and handles orphaned or manually tampered jobs.Strict Pydantic validation for cron expressions and commands are also presented.

🏗️ Architecture & Technical Details

The module strictly follows the project's Domain-Driven Design (DDD) standards:

  • Entrypoints: FastAPI endpoints for user interactions (/scheduler/jobs).
  • Service Layer: Manages application logic, Unit of Work (SQLAlchemy), and Background Tasks orchestration.
  • Domain Layer: Contains the core business logic (CronJobScheduler), abstracting the complexities of the underlying crontab system.
  • Adapters: Handles database schemas, repositories, and cross-layer DTOs.
  • Infrastructure: * Two new systemd daemons introduced: scheduler-domain.service and scheduler-service-layer.service.
  • RabbitMQ RPC integration established for inter-layer and inter-service communication.
  • Alembic migration added for the new scheduler_jobs table.

🧪 Testing & QA

Extensive unit testing of the CronJobScheduler with fully mocked CronTab contexts to guarantee safe execution in CI/CD environments without altering the host OS. Complete coverage of FastAPI endpoints and Service Layer logic using pytest-mock. The entire module is strictly typed and fully compliant with project standards (mypy and strict ruff configurations, including ANN, BLE, and E501).

@rustamhse rustamhse requested a review from Aerodisk as a code owner April 7, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants