forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0077.yml
75 lines (75 loc) · 3.81 KB
/
0077.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
version: 77
description: create additional functions to filter workers on state and quarantined status
methods:
get_queue_workers_with_wm_join_state:
description: |-
Get non-expired queue workers by state ordered by worker_pool_id, worker_group, and worker_id.
Workers are not considered expired until after their quarantine date expires.
If the pagination arguments are both NULL, all rows are returned.
Otherwise, page_size rows are returned at offset page_offset.
This also performs an outer join with the worker_manager.worker table for more data.
mode: read
serviceName: worker_manager
args: task_queue_id_in text, expires_in timestamptz, page_size_in integer, page_offset_in integer, worker_state_in text
returns: table(worker_pool_id text, worker_group text, worker_id text, quarantine_until timestamptz, expires timestamptz, first_claim timestamptz, recent_tasks jsonb, last_date_active timestamptz, state text, capacity int4, provider_id text, etag uuid)
body: |-
begin
return query
select
queue_workers.task_queue_id as worker_pool_id,
queue_workers.worker_group,
queue_workers.worker_id,
queue_workers.quarantine_until,
queue_workers.expires,
queue_workers.first_claim,
queue_workers.recent_tasks,
queue_workers.last_date_active,
workers.state,
workers.capacity,
workers.provider_id,
public.gen_random_uuid()
from queue_workers
full outer join workers on workers.worker_id = queue_workers.worker_id
where
workers.state = worker_state_in and
(queue_workers.task_queue_id = task_queue_id_in or get_queue_workers_with_wm_join_state.task_queue_id_in is null) and
((queue_workers.expires > expires_in and queue_workers.quarantine_until < expires_in) or get_queue_workers_with_wm_join_state.expires_in is null)
order by worker_pool_id, worker_group, worker_id
limit get_page_limit(page_size_in)
offset get_page_offset(page_offset_in);
end
get_queue_workers_with_wm_join_quarantined:
description: |-
Get quarantined queue workers 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.
This also performs an outer join with the worker_manager.worker table for more data.
mode: read
serviceName: worker_manager
args: task_queue_id_in text, page_size_in integer, page_offset_in integer
returns: table(worker_pool_id text, worker_group text, worker_id text, quarantine_until timestamptz, expires timestamptz, first_claim timestamptz, recent_tasks jsonb, last_date_active timestamptz, state text, capacity int4, provider_id text, etag uuid)
body: |-
begin
return query
select
queue_workers.task_queue_id as worker_pool_id,
queue_workers.worker_group,
queue_workers.worker_id,
queue_workers.quarantine_until,
queue_workers.expires,
queue_workers.first_claim,
queue_workers.recent_tasks,
queue_workers.last_date_active,
workers.state,
workers.capacity,
workers.provider_id,
public.gen_random_uuid()
from queue_workers
full outer join workers on workers.worker_id = queue_workers.worker_id
where
(queue_workers.task_queue_id = task_queue_id_in or get_queue_workers_with_wm_join_quarantined.task_queue_id_in is null) and
(queue_workers.expires >= now() and queue_workers.quarantine_until >= now())
order by worker_pool_id, worker_group, worker_id
limit get_page_limit(page_size_in)
offset get_page_offset(page_offset_in);
end