backend module
This module defines the FastAPI app and its routes for scheduling jobs. When run as a script, it starts a uvicorn server on port defined in the config.py file.
The app uses CORS middleware to handle cross-origin requests and defines endpoints to schedule jobs and retrieve job information. It interacts with the algorithms module to calculate schedules based on different scheduling algorithms.
Endpoints: - POST /schedule_jobs: Accepts JSON payload to schedule jobs based on application and platform data. - GET /: Provides a basic test endpoint to confirm the app is running.
See the function docstrings within this module for more detailed API documentation.
- backend.read_root()[source]
Retrieve the root URL. For testing purposes.
- Returns:
A simple dictionary with a greeting.
- Return type:
dict
- backend.schedule_jobs(data: dict)[source]
Schedule jobs based on the provided application and platform data.
This endpoint processes a JSON payload containing application and platform configurations, then calculates schedules using Least Deadline First (LDF), Earliest Deadline First (EDF), Rate Monotonic (RMS) and Least Laxity (LL) scheduling algorithms on single-core setups.
- Parameters:
data (dict) – A dictionary containing ‘application’ and ‘platform’ data necessary for scheduling.
- Raises:
HTTPException – If the ‘application’ or ‘platform’ data is missing or malformed, a 400 error is raised.
- Returns:
- A dictionary containing schedules calculated using different algorithms:
schedule1: Schedule using Latest Deadline First (LDF) schedulin on single-core.
schedule2: Schedule using Earliest Deadline First (EDF) scheduling on single-core.
schedule3: Schedule using Rate Monotonic Scheduling (RMS) on single-core.
schedule4: Schedule using Least Laxity (LL) on single-core.
- Return type:
dict