forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop instances that are not doing anything useful anymore (taskcluste…
…r#6333) * feat(w-m): Stop instances that are not doing anything useful anymore This can happen when docker/generic worker process dies and stops calling queue.claimWork/queue.reclaimTask Such workers would either be not known to the queue, or would have their last_date_active way in the past. In such cases killing instance is the only option to free up resources. * Moved `claimTimeout` to `lifecycle` parameter of worker pool config. * Apply suggestions from code review Co-authored-by: Matt Boris <92693437+matt-boris@users.noreply.github.com> * Set minimum queue inactivity timeout to 30 minutes. * Set minimum queueInactivityTimeout to 1 minute
- Loading branch information
Showing
23 changed files
with
592 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
audience: admins | ||
level: minor | ||
reference: issue 6142 | ||
--- | ||
|
||
Worker manager stops instances that are not active in queue after short timeout. | ||
This is to prevent instances from running when worker fails to start claiming work or dies and does not reclaims task. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const testing = require('taskcluster-lib-testing'); | ||
|
||
suite(testing.suiteName(), function() { | ||
// this version only updates method, | ||
// to trigger index usage, so no tests are needed | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: 87 | ||
description: add queue information to get_non_stopped_workers_quntil_providers | ||
methods: | ||
get_non_stopped_workers_quntil_providers: | ||
deprecated: true | ||
get_non_stopped_workers_scanner: | ||
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`. | ||
The `quaratine_until` contains NULL or a date in the past if the | ||
worker is not quarantined, otherwise the date until which it is | ||
quaratined. `first_claim` and `last_date_active` contains information | ||
known to the queue service about the worker. | ||
`providers_filter_cond` and `providers_filter_value` used to | ||
filter `=` or `<>` provider by value. | ||
mode: read | ||
serviceName: worker_manager | ||
args: worker_pool_id_in text, worker_group_in text, worker_id_in text, providers_filter_cond text, providers_filter_value 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, secret jsonb, etag uuid, quarantine_until timestamptz, first_claim timestamptz, last_date_active 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, | ||
workers.secret, | ||
workers.etag, | ||
queue_workers.quarantine_until, | ||
queue_workers.first_claim, | ||
queue_workers.last_date_active | ||
from | ||
workers | ||
left join queue_workers on | ||
workers.worker_pool_id = queue_workers.task_queue_id and | ||
workers.worker_id = queue_workers.worker_id and | ||
workers.worker_group = queue_workers.worker_group | ||
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') and | ||
(providers_filter_cond is null or providers_filter_value is null or | ||
case | ||
when providers_filter_cond = '=' | ||
then workers.provider_id = ANY(string_to_array(providers_filter_value, ',')) | ||
when providers_filter_cond = '<>' | ||
then workers.provider_id <> ALL(string_to_array(providers_filter_value, ',')) | ||
end | ||
) | ||
order by worker_pool_id, worker_group, worker_id | ||
limit get_page_limit(page_size_in) | ||
offset get_page_offset(page_offset_in); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.