From 6b078c67594fac6bf5ee0204552d6330a5fff2d6 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Mon, 5 Feb 2018 10:16:01 +0100 Subject: Implement workflow task dependencies --- database/schema.sql | 32 +++++++++++++++++------- database/test.sql | 70 +++++++++++++++++++++++++++-------------------------- opendc-frontend | 2 +- opendc-simulator | 2 +- opendc-web-server | 2 +- 5 files changed, 62 insertions(+), 46 deletions(-) diff --git a/database/schema.sql b/database/schema.sql index 7f0d5879..89ba841e 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 @@ -180,13 +180,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 +329,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 +428,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 +556,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 diff --git a/database/test.sql b/database/test.sql index fa7fb8aa..452544e0 100644 --- a/database/test.sql +++ b/database/test.sql @@ -43,8 +43,9 @@ INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALU INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (25, 10000, 1, 'PARALLEL'); INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (25, 10000, 1, 'PARALLEL'); INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (26, 10000, 1, 'PARALLEL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (80, 200000, 1, 1, 'PARALLEL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (80, 200000, 1, 'PARALLEL'); + +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (1, 5); -- Image Processing Trace INSERT INTO traces (name) VALUES ('Image Processing'); @@ -121,38 +122,39 @@ INSERT INTO traces (name) VALUES ('Path planning'); INSERT INTO jobs (name, trace_id) VALUES ('Path planning', 3); INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (0, 1000000, 3, 'PARALLEL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (11, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (12, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (13, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (14, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (11, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (12, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (13, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (14, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (11, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (12, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (13, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (14, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (11, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (12, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (13, 200000, 3, 66, 'SEQUENTIAL'); -INSERT INTO tasks (start_tick, total_flop_count, job_id, task_dependency_id, parallelizability) -VALUES (14, 200000, 3, 66, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (11, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (12, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (13, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (14, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (11, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (12, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (13, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (14, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (11, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (12, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (13, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (14, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (11, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (12, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (13, 200000, 3, 'SEQUENTIAL'); +INSERT INTO tasks (start_tick, total_flop_count, job_id, parallelizability) VALUES (14, 200000, 3, 'SEQUENTIAL'); + +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 67); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 68); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 69); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 70); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 71); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 72); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 73); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 74); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 75); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 76); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 77); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 78); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 79); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 80); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 81); +INSERT INTO task_dependencies (first_task_id, second_task_id) VALUES (66, 82); -- Parallelizable Trace INSERT INTO traces (name) VALUES ('Parallel heavy trace'); diff --git a/opendc-frontend b/opendc-frontend index 4d08462e..0c7862a9 160000 --- a/opendc-frontend +++ b/opendc-frontend @@ -1 +1 @@ -Subproject commit 4d08462eb8d662ea153c6183c9aca318a3c51390 +Subproject commit 0c7862a97ed957fe6d96bbd2ef8545b5c4be23d0 diff --git a/opendc-simulator b/opendc-simulator index 8666a78b..aa20894c 160000 --- a/opendc-simulator +++ b/opendc-simulator @@ -1 +1 @@ -Subproject commit 8666a78b86a40c1d8dab28dd18e841318c01f97f +Subproject commit aa20894c20658c550a243eddd017973090b0035d diff --git a/opendc-web-server b/opendc-web-server index b87faa0b..cd116ba5 160000 --- a/opendc-web-server +++ b/opendc-web-server @@ -1 +1 @@ -Subproject commit b87faa0bccf661a2b6a948d9420d52a19a63d9a2 +Subproject commit cd116ba5063b9bfda029196b310207b45e21604a -- cgit v1.2.3