Skip to content

Commit 24e74fa

Browse files
committed
Update the proposal from task-run level to the task and task group
levels
1 parent a80bc75 commit 24e74fa

File tree

3 files changed

+41
-19
lines changed

3 files changed

+41
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ See [mechanics](mechanics.md) for more detail.
6868
| RFC#180 | [Github cancel previous tasks](rfcs/0180-Github-cancel-previous-tasks.md) |
6969
| RFC#182 | [Allow remote references to .taskcluster.yml files processed by Taskcluster-GitHub](rfcs/0182-taskcluster-yml-remote-references.md) |
7070
| RFC#189 | [Batch APIs for task definition, status and index path](rfcs/0189-batch-task-apis.md) |
71-
| RFC#190 | [Queue change task run priority](rfcs/0190-queue-change-task-run-priority.md) |
71+
| RFC#190 | [Queue change task / task group priority](rfcs/0190-queue-change-task-run-priority.md) |

rfcs/0190-queue-change-task-run-priority.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RFC 0190 - Queue change task run priority
1+
# RFC 0190 - Queue change task / task group priority
22
* Comments: [#0190](https://github.com/taskcluster/taskcluster-rfcs/pull/190)
33
* Proposed by: @lotas
44

@@ -7,45 +7,67 @@
77
Since we refactored queue internals it became possible to see what tasks are pending for a particular
88
worker pool / task queue.
99

10-
This RFC proposes new API method that would allow to change the priority of the existing task run.
10+
This RFC proposes new API method that would allow to change the priority of the existing task run / task group.
1111

1212
## Motivation
1313

1414
There might be several use-cases when some worker pool has a lot of pending tasks and there is a need
1515
to move some more important tasks to the top of the waiting list, or also move down less important ones.
1616

17-
Instead of cancelling existing tasks we can instead choose to change task run priorities.
17+
Instead of cancelling some existing tasks we can change task run priorities.
18+
19+
Use-case examples:
20+
21+
* We have a high-priority patch running tasks on Try. We want to bump the priority of all tasks in this task group
22+
* We have a chemspill release or high priority nightly to get out. We want to bump the priority of all tasks in one or more groups
23+
* We are waiting for a specific task in a low resource pool (eg: mac hardware). We want to bump the priority of that specific task
24+
* There are several tasks with the same highest priority and one of them is more important. We want to lower the priority of the less important task
1825

1926
## Details
2027

21-
I propose we implement this on a task run level and not the task itself:
28+
Queue service will expose new methods:
29+
30+
* `queue.changeTaskPriority(taskId, newPriority)`
31+
* `queue.changeTaskGroupPriority(taskGroupId, newPriority)`
32+
33+
New priority would be stored along the task definition for a given task or all tasks within the task group.
2234

23-
* tasks are supposed to be immutable
24-
* changing the priority makes more sense in the context of a specific run, not the whole task
35+
The process to change single task will be as follows:
2536

26-
Queue service will expose new method `queue.changeTaskRunPriority(taskId, runId, newPriority)`.
37+
* new task priority will be stored in the database as `task.priority_override` column
38+
* if task was scheduled already, its priority in the `queue_pending_tasks` table will be updated
39+
* if the tasks run fails and new one is created, it will check if `task.priority_override` is set and use it instead of the original priority
2740

28-
This will try to do the following:
41+
The process to change the whole task group will be as follows:
2942

30-
* update `task.runs[runId]` in the database to reflect priority change (possibly extra field to keep the original)
31-
* update `priority` field in the `queue_pending_tasks` table
43+
* all tasks in the task group will be updated to store the new priority in the `task.priority_override` column
44+
* all currently scheduled tasks would be attempted to be updated in the `queue_pending_tasks` table
45+
* all unscheduled tasks and tasks that will be restarted will use the new priority
3246

33-
If any of this fails (for example task is being changed by some other process), this method will also fail.
47+
### New scopes
3448

3549
This will also require introduction of the new scopes (anyOf):
3650

37-
* `queue:change-task-run-priority-in-queue:<taskQueueId>`
38-
* `queue:change-task-run-priority:<taskId>`
39-
* `queue:lower-task-run-priority:<taskId>` to only allow lowering the priority
40-
* `queue:raise-task-run-priority:<taskId>` to only allow raising the priority
51+
* `queue:change-task-priority-in-queue:<taskQueueId>`
52+
* `queue:change-task-priority:<taskId>`
53+
* `queue:lower-task-priority:<taskId>` to only allow lowering the priority
54+
* `queue:raise-task-priority:<taskId>` to only allow raising the priority
55+
56+
And for task group:
57+
58+
* `queue:change-task-group-priority:<schedulerId>/<taskGroupId>` (for consistency with existing task group scopes)
59+
* `queue:lower-task-group-priority:<taskGroupId>` to only allow lowering the priority
60+
* `queue:raise-task-group-priority:<taskGroupId>` to only allow raising the priority
61+
62+
### Priority calculation
4163

4264
Current order for picking up tasks is based on the task priority and insertion time (FIFO).
4365
This RFC proposes to change the priority only, and leave the insertion time as is.
4466

4567
### Other considerations
4668

47-
Chain of Trust validation might be broken if we change too much of the task definition or run.
48-
We need to make sure we don't break it with this change.
69+
To insure that Chain of Trust validation is not affected, we aim to keep the original task definition
70+
and store the new priority in a separate column.
4971

5072
## Implementation
5173

rfcs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@
5656
| RFC#180 | [Github cancel previous tasks](0180-Github-cancel-previous-tasks.md) |
5757
| RFC#182 | [Allow remote references to .taskcluster.yml files processed by Taskcluster-GitHub](0182-taskcluster-yml-remote-references.md) |
5858
| RFC#189 | [Batch APIs for task definition, status and index path](0189-batch-task-apis.md) |
59-
| RFC#190 | [Queue change task run priority](0190-queue-change-task-run-priority.md) |
59+
| RFC#190 | [Queue change task / task group priority](0190-queue-change-task-run-priority.md) |

0 commit comments

Comments
 (0)