This repository contains the backend server for the Task Scheduling front-end. The backend is responsible for processing the logical model, running scheduling algorithms, and communicating with the frontend. It is built with FastAPI and provides a RESTful API for interaction with the frontend.
- Getting Started
- Technologies Used
- Features
- API Endpoints
- Input and Output Schemas
- Components
- Contributing
- Clone the repository:
git clone [https://github.com/linem-davton/graphdraw-eslab-backend.git
-
Navigate to the project directory:
cd graphdraw-eslab-backend
-
Install dependencies:
pip install -r requirements.txt
-
Start the development server:
cd src python src/backend.py
The backend server will start running on http://localhost:8000
-
Access the API:
- The backend server will be running at http://localhost:8000.
- If everything is set up correctly, you should see the following message: {"Hello": "World"}
-
To access the API documentation, go to http://localhost:8000/docs.
-
Visit the frontend at eslab2.pages.dev, and input the logical and platform model as defined in input schema to schedule tasks.
-
POST /schedule_jobs: Accepts a task graph in JSON format and returns the scheduled tasks using four different algorithms.
-
GET /: Root endpoint to verify if the server is running.
Learn more about HTTP Methods
The backend expects input JSON schema mentioned in the file input_schema.json
This JSON Schema defines the structure for the input JSON model used by the scheduling algorithms.
It ensures that:
- Jobs: Each job has an id, wcet (worst case execution time), mcet (mean case execution time), and deadline (all integers).
- Messages: Each message has an id, sender, receiver, size (all integers), and timetriggered (integer).
- Nodes: Each node has an id (integer) and type (string).
- Links: Each link has an id, start_node, end_node, link_delay, bandwidth (all integers), and type (string).
By adhering to this schema, you can validate the input JSON model before processing it with the scheduling algorithms.
Ouput schema can be found in this file, output_schema.json
This schema defines the structure for the schedule object produced by the scheduling algorithms. It ensures that each scheduled item has:
- job_id: The identifier of the job, which can be a string or integer.
- node_id: The identifier of the node where the job is scheduled, which can be a string or integer.
- start_time: The time when the job starts execution.
- end_time: The time when the job finishes execution.
- deadline: The deadline by which the job must be completed.
- missed_deadline: If a task misses a deadline, it is stored in missed_deadline.
- backend.py: Main entry point for the FastAPI backend server.
- Handles API endpoints and routing.
- Configures CORS middleware.
- algorithms.py: Contains the implementation of the scheduling algorithms.
- config.py: Configuration file for backend settings.
- requirements.txt: File listing all the dependencies required for the project.
- test_scheduling_algorithms.py: Contains the test functions to check the accuracy of the algorithms.
- Multiple Scheduling Algorithms: Implements scheduling algorithms for task scheduling.
- Input Validation: Ensures valid data format for processing.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (git checkout -b feature/your-feature-name).
- Make your changes.
- Commit your changes (git commit -m 'Add some feature').
- Push to the branch (git push origin feature/your-feature-name).
- Create a new Pull Request.
- Github Backend Repository: Task Scheduling Backend
- Github Frontend Repository: Task Scheduling Frontend
- More about the Schedule Visualization Frontend
- For a comprehensive overview of the algorithms, see Scheduling Algorithms Documentation