← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:db-builder-gpu into launchpad:db-devel

 

Colin Watson has proposed merging ~cjwatson/launchpad:db-builder-gpu into launchpad:db-devel.

Commit message:
Add Builder.gpu and various *.require_gpu columns

Requested reviews:
  William Grant (wgrant): db
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/433187

This will allow us to partition the build farm into builders with GPU support and those without, and to mark certain Git repositories as requiring GPU support for their CI builds.  (If necessary, this could be extended to other build types in future.)

`Builder` is small, so filling in its `gpu` column is cheap enough.  For the other tables it makes more sense to handle NULLs in the application, and maybe backfill at some point if we need to.

I considered extending the index on `BuildQueue(status, virtualized, processor, lastscore DESC, id)`, but that doesn't seem to be necessary: checking on qastaging which happens to have usefully long build queues at the moment, buildd-manager's critical query in `BuildQueueSet.findBuildCandidates` already has an extra condition (`BuildQueue.builder == None`) beyond what's supported by the index, and adding an additional condition on another `BuildQueue` column makes no measurable performance difference.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:db-builder-gpu into launchpad:db-devel.
diff --git a/database/schema/patch-2211-13-0.sql b/database/schema/patch-2211-13-0.sql
new file mode 100644
index 0000000..f013513
--- /dev/null
+++ b/database/schema/patch-2211-13-0.sql
@@ -0,0 +1,16 @@
+-- Copyright 2022 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+ALTER TABLE Builder ADD COLUMN gpu boolean DEFAULT false NOT NULL;
+ALTER TABLE BuildQueue ADD COLUMN require_gpu boolean;
+ALTER TABLE CIBuild ADD COLUMN require_gpu boolean;
+ALTER TABLE GitRepository ADD COLUMN require_gpu boolean;
+
+COMMENT ON COLUMN Builder.gpu IS 'Whether the builder has GPU support.';
+COMMENT ON COLUMN BuildQueue.require_gpu IS 'Whether the associated build farm job requires GPU support.';
+COMMENT ON COLUMN CIBuild.require_gpu IS 'Whether this CI build requires GPU support.';
+COMMENT ON COLUMN GitRepository.require_gpu IS 'Whether builds of this repository require GPU support.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2211, 13, 0);