feat: add worker distributor and model registry
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
56
internal/workscheduler/queries.sql
Normal file
56
internal/workscheduler/queries.sql
Normal 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;
|
||||
|
Reference in New Issue
Block a user