From dfddb6c25c96598295ad8b50092c9f4dd946e560 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 20 Jul 2018 00:19:03 +0200 Subject: feat: Implement Scheduler Reference Architecture This change implements the parts of the Datacenter Scheduling Reference Architecture as published in SC18. This commit consists of changes to the database schema such as: - **Removal of `parallelizability` column in `Task`** This field was not used by the simulator and we opted to use a field describing the amount of cores the task can run on instead. - **Removal of `task_id` column in `MachineState`** This field did not make sense anymore now that a machine can run multiple tasks. Fortunately, this field is not used in the frontend. --- database/schema.sql | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'database/schema.sql') diff --git a/database/schema.sql b/database/schema.sql index 7f0d5879..15dbf043 100644 --- a/database/schema.sql +++ b/database/schema.sql @@ -63,7 +63,7 @@ INSERT INTO authorization_levels (level) VALUES ('VIEW'); * - DD is the two-digit day of the month (1-31) * - HH is the two-digit hours part (0-23) * - MM is the two-digit minutes part (0-59) -* - SS is the two-digit secodns part (0-59) +* - SS is the two-digit seconds part (0-59) */ -- Simulation @@ -146,9 +146,18 @@ DROP TABLE IF EXISTS schedulers; CREATE TABLE schedulers ( name VARCHAR(50) PRIMARY KEY NOT NULL ); -INSERT INTO schedulers (name) VALUES ('DEFAULT'); -INSERT INTO schedulers (name) VALUES ('SRTF'); -INSERT INTO schedulers (name) VALUES ('FIFO'); +INSERT INTO schedulers (name) VALUES ('FIFO-FIRSTFIT'); +INSERT INTO schedulers (name) VALUES ('FIFO-BESTFIT'); +INSERT INTO schedulers (name) VALUES ('FIFO-WORSTFIT'); +INSERT INTO schedulers (name) VALUES ('FIFO-RANDOM'); +INSERT INTO schedulers (name) VALUES ('SRTF-FIRSTFIT'); +INSERT INTO schedulers (name) VALUES ('SRTF-BESTFIT'); +INSERT INTO schedulers (name) VALUES ('SRTF-WORSTFIT'); +INSERT INTO schedulers (name) VALUES ('SRTF-RANDOM'); +INSERT INTO schedulers (name) VALUES ('RANDOM-FIRSTFIT'); +INSERT INTO schedulers (name) VALUES ('RANDOM-BESTFIT'); +INSERT INTO schedulers (name) VALUES ('RANDOM-WORSTFIT'); +INSERT INTO schedulers (name) VALUES ('RANDOM-RANDOM'); /* * Each simulation has a single trace. A trace contains tasks and their start times. @@ -180,13 +189,24 @@ CREATE TABLE tasks ( start_tick INTEGER NOT NULL CHECK (start_tick >= 0), total_flop_count INTEGER NOT NULL, job_id INTEGER NOT NULL, - task_dependency_id INTEGER NULL, parallelizability VARCHAR(50) NOT NULL, FOREIGN KEY (job_id) REFERENCES jobs (id) + ON DELETE CASCADE + ON UPDATE CASCADE +); + +-- A dependency between two tasks. +DROP TABLE IF EXISTS task_dependencies; +CREATE TABLE task_dependencies ( + first_task_id INTEGER NOT NULL, + second_task_id INTEGER NOT NULL, + + PRIMARY KEY (first_task_id, second_task_id), + FOREIGN KEY (first_task_id) REFERENCES tasks (id) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (task_dependency_id) REFERENCES tasks (id) + FOREIGN KEY (second_task_id) REFERENCES tasks (id) ON DELETE CASCADE ON UPDATE CASCADE ); @@ -318,8 +338,9 @@ DELIMITER // -- and tiles in a room are connected. DROP TRIGGER IF EXISTS before_insert_tiles_check_existence; CREATE TRIGGER before_insert_tiles_check_existence -BEFORE INSERT ON tiles -FOR EACH ROW + BEFORE INSERT + ON tiles + FOR EACH ROW BEGIN -- checking tile overlap -- a tile already exists such that.. @@ -416,8 +437,9 @@ DELIMITER // -- Make sure objects are added to tiles in rooms they're allowed to be in. DROP TRIGGER IF EXISTS before_update_tiles; CREATE TRIGGER before_update_tiles -BEFORE UPDATE ON tiles -FOR EACH ROW + BEFORE UPDATE + ON tiles + FOR EACH ROW BEGIN IF ((NEW.object_id IS NOT NULL) AND ( @@ -543,8 +565,9 @@ DELIMITER // -- Make sure a machine is not inserted at a position that does not exist for its rack. DROP TRIGGER IF EXISTS before_insert_machine; CREATE TRIGGER before_insert_machine -BEFORE INSERT ON machines -FOR EACH ROW + BEFORE INSERT + ON machines + FOR EACH ROW BEGIN IF ( NEW.position > (SELECT capacity -- cgit v1.2.3