-
Notifications
You must be signed in to change notification settings - Fork 250
/
0047.yml
39 lines (38 loc) · 1.63 KB
/
0047.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
version: 47
description: add get_non_stopped_workers db function
methods:
get_non_stopped_workers:
description: |-
Get non-stopped workers filtered by the optional arguments,
ordered by `worker_pool_id`, `worker_group`, and `worker_id`.
If the pagination arguments are both NULL, all rows are returned.
Otherwise, page_size rows are returned at offset `page_offset`.
mode: read
serviceName: worker_manager
args: worker_pool_id_in text, worker_group_in text, worker_id_in text, page_size_in integer, page_offset_in integer
returns: table(worker_pool_id text, worker_group text, worker_id text, provider_id text, created timestamptz, expires timestamptz, state text, provider_data jsonb, capacity integer, last_modified timestamptz, last_checked timestamptz)
body: |-
begin
return query
select
workers.worker_pool_id,
workers.worker_group,
workers.worker_id,
workers.provider_id,
workers.created,
workers.expires,
workers.state,
workers.provider_data,
workers.capacity,
workers.last_modified,
workers.last_checked
from workers
where
(workers.worker_pool_id = worker_pool_id_in or worker_pool_id_in is null) and
(workers.worker_group = worker_group_in or worker_group_in is null) and
(workers.worker_id = worker_id_in or worker_id_in is null) and
(workers.state <> 'stopped')
order by worker_pool_id, worker_group, worker_id
limit get_page_limit(page_size_in)
offset get_page_offset(page_offset_in);
end