From 9dd26c6ee5b29cd61f02c535eccbd2d73cae51ca Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 10 Apr 2020 20:30:40 +0100 Subject: Create tables for allocating builds One table to store which build is allocated to which agent, and another to store a "plan" of allocations. For this plan, a build can be potentially allocated to multiple agents, and which agent it will be allocated to depends on which agent claims it first. --- sqitch/pg/deploy/build_allocation_tables.sql | 7 +++++++ sqitch/pg/revert/build_allocation_tables.sql | 7 +++++++ sqitch/pg/verify/build_allocation_tables.sql | 7 +++++++ sqitch/sqitch.plan | 1 + sqitch/sqlite/deploy/build_allocation_tables.sql | 17 +++++++++++++++++ sqitch/sqlite/revert/build_allocation_tables.sql | 7 +++++++ sqitch/sqlite/verify/build_allocation_tables.sql | 7 +++++++ 7 files changed, 53 insertions(+) create mode 100644 sqitch/pg/deploy/build_allocation_tables.sql create mode 100644 sqitch/pg/revert/build_allocation_tables.sql create mode 100644 sqitch/pg/verify/build_allocation_tables.sql create mode 100644 sqitch/sqlite/deploy/build_allocation_tables.sql create mode 100644 sqitch/sqlite/revert/build_allocation_tables.sql create mode 100644 sqitch/sqlite/verify/build_allocation_tables.sql (limited to 'sqitch') diff --git a/sqitch/pg/deploy/build_allocation_tables.sql b/sqitch/pg/deploy/build_allocation_tables.sql new file mode 100644 index 0000000..443089b --- /dev/null +++ b/sqitch/pg/deploy/build_allocation_tables.sql @@ -0,0 +1,7 @@ +-- Deploy guix-build-coordinator:build_allocation_tables to pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/pg/revert/build_allocation_tables.sql b/sqitch/pg/revert/build_allocation_tables.sql new file mode 100644 index 0000000..14d24d3 --- /dev/null +++ b/sqitch/pg/revert/build_allocation_tables.sql @@ -0,0 +1,7 @@ +-- Revert guix-build-coordinator:build_allocation_tables from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/pg/verify/build_allocation_tables.sql b/sqitch/pg/verify/build_allocation_tables.sql new file mode 100644 index 0000000..2f382ca --- /dev/null +++ b/sqitch/pg/verify/build_allocation_tables.sql @@ -0,0 +1,7 @@ +-- Verify guix-build-coordinator:build_allocation_tables on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index ff6995b..698e54f 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -5,3 +5,4 @@ schema 2020-04-03T21:01:15Z Christopher Baines # Create a sch initial_derivation_tables 2020-04-04T09:48:34Z Christopher Baines # Create initial derivation related tables create_builds 2020-04-06T18:50:48Z Christopher Baines # Create builds initial_agent_tables 2020-04-09T20:03:53Z Christopher Baines # Create initial tables for agent related state +build_allocation_tables 2020-04-10T19:26:36Z Christopher Baines # Create initial tables for allocating builds diff --git a/sqitch/sqlite/deploy/build_allocation_tables.sql b/sqitch/sqlite/deploy/build_allocation_tables.sql new file mode 100644 index 0000000..c87438c --- /dev/null +++ b/sqitch/sqlite/deploy/build_allocation_tables.sql @@ -0,0 +1,17 @@ +-- Deploy guix-build-coordinator:build_allocation_tables to sqlite + +BEGIN; + +CREATE TABLE allocated_builds ( + build_id PRIMARY KEY NOT NULL REFERENCES builds (uuid), + agent_id NOT NULL REFERENCES agents (id) +); + +CREATE TABLE build_allocation_plan ( + build_id NOT NULL REFERENCES builds (uuid), + agent_id NOT NULL REFERENCES agents (id), + ordering INTEGER NOT NULL, + PRIMARY KEY (agent_id, build_id) +); + +COMMIT; diff --git a/sqitch/sqlite/revert/build_allocation_tables.sql b/sqitch/sqlite/revert/build_allocation_tables.sql new file mode 100644 index 0000000..193cc59 --- /dev/null +++ b/sqitch/sqlite/revert/build_allocation_tables.sql @@ -0,0 +1,7 @@ +-- Revert guix-build-coordinator:build_allocation_tables from sqlite + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqlite/verify/build_allocation_tables.sql b/sqitch/sqlite/verify/build_allocation_tables.sql new file mode 100644 index 0000000..91776a5 --- /dev/null +++ b/sqitch/sqlite/verify/build_allocation_tables.sql @@ -0,0 +1,7 @@ +-- Verify guix-build-coordinator:build_allocation_tables on sqlite + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3