feat: add worker distributor and model registry
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-01-18 01:46:37 +01:00
parent 54aa310583
commit 2cdab4a1ab
28 changed files with 1169 additions and 29 deletions

View File

@@ -0,0 +1,56 @@
-- name: Ping :one
SELECT 1;
-- name: GetCurrentQueueSize :one
SELECT
COUNT(*) current_queue_size
FROM
work_schedule
WHERE
worker_id = $1
AND state <> 'archived';
-- name: InsertQueueItem :exec
INSERT INTO work_schedule
(
schedule_id
, worker_id
, start_run
, end_run
, state
)
VALUES
(
$1
, $2
, $3
, $4
, 'pending'
);
-- name: GetNext :one
SELECT
*
FROM
work_schedule
WHERE
worker_id = $1
AND state = 'pending'
ORDER BY updated_at DESC
LIMIT 1;
-- name: StartProcessing :exec
UPDATE work_schedule
SET
state = 'processing'
WHERE
schedule_id = $1;
-- name: Archive :exec
UPDATE work_schedule
SET
state = 'archived'
WHERE
schedule_id = $1;