Project

General

Profile

Container dispatch » History » Version 10

Peter Amstutz, 12/11/2015 09:40 PM

1 1 Peter Amstutz
h1. Crunch2 dispatch
2 2 Peter Amstutz
3 9 Peter Amstutz
h2. Design sketch
4
5
sLURm to crunCH = "Lurch"
6
7
* Use websockets to listen for container events (new containers added, priority changes)
8
9
Flow:
10
11 1 Peter Amstutz
* Monitor containers table. 
12
## When a new container appears, claim it
13 10 Peter Amstutz
## Try to run immediately @srun --immediate --share --output=none --error=none --input=none@
14
## If unable to salloc, post a request for a new node to node manager (mechanism TBD)
15
## Dispatch the job @srun --jobid@
16 1 Peter Amstutz
* Monitor slurm job status.
17 9 Peter Amstutz
18 10 Peter Amstutz
Decision points:
19
20
* What language?  (Python/Go/Ruby)
21
** Go will require a Go websockets client
22 9 Peter Amstutz
23
h1. Notes
24
25 3 Peter Amstutz
Some discussion notes from https://dev.arvados.org/issues/6429 and https://dev.arvados.org/issues/6518
26
27 4 Peter Amstutz
h2. Interaction with node manager
28 3 Peter Amstutz
29 2 Peter Amstutz
Suggest writing crunch 2 job dispatcher as a new set of actors in node manger.
30
31
This would enable us to solve the question of communication between the scheduler and cloud node management (#6520).
32
33
Node manager already has a lot of the framework we will want like concurrency (can have one actor per job) and a configuration system.
34
35 1 Peter Amstutz
Different schedulers (slurm, sge, kubernetes) can be implemented as modules similarly to how different cloud providers are supported now.
36 4 Peter Amstutz
37
If we don't actually combine them, we should at least move the logic of deciding how many and what size nodes to run from the node manager to the dispatcher; the dispatcher can then communicate its wishlist to node manager.
38 2 Peter Amstutz
39
h2.  Interaction with API
40
41
More ideas:
42
43
Have a "dispatchers" table. Dispatcher processes are responsible for pinging the API server similar to how it is done for nodes to show they are alive.
44
45
A dispatcher claims a container by setting "dispatcher" field to it's UUID. This field can only be set once and that locks the record so that only the dispatcher can update it.
46
47
If a dispatcher stops pinging, the containers it has claimed should be marked as TempFail.
48
49
Dispatchers should be able to annotate containers (preferably through links) for example "I can't run this because I don't have any nodes with 40 GiB of RAM".
50
51
h2. Retry
52
53
How do we handle failure? Is the dispatcher required to retry containers that fail, or is the dispatcher a "best effort" service and the API decides to retry by scheduling a new container?
54
55
Currently the container_uuid field only holds a single container_uuid at a time. If the API schedules a new container, does that mean any container requests associated with that container get updated with the new container?
56
57
If the container_uuid field only holds one container at a time, and container don't link back to the container requests that created, then we don't have a way to record of past attempts to fulfill this request. This means we don't have anything to check against container_count_max. A few possible solutions:
58
59
* Make container_uuid an array of containers created to fulfill a given container request (this introduces complexity)
60
* Decrement container_count_max on the request when submitting a new container
61
* Compute content address of the container request and discover containers with that content address. This would conflict with "no reuse" or "impure" requests which are supposed to ignore past execution history. Could solve this by salting the content address with a timestamp; "no reuse" containers would never ever be reusable which might be fine.
62
63
I think we should distinguish between infrastructure failure and task failure by distinguishing between "TempFail" and "PermFail" in the container state. "TempFail" shouldn't count againt the container_count_max count, or alternately we only honor container_count_max for "TempFail" tasks and don't retry "PermFail".
64
65
Ideally, "TempFail" containers should retry forever, but with a backoff. One way to do the backoff is to schedule the container to run at a specific time in the future.
66
67
h2. Scheduling
68
69
Having a field specifying "wait until time X to run this container" would be generally useful for cron-style tasks.
70 5 Peter Amstutz
71
h2. State changes
72
73
Container request:
74
75
||priority == 0|priority > 0|
76
|Uncommitted|nothing|nothing|
77
|Committed|set container priority to max(all request priority)|set container priority to max(all request priority)|
78 6 Peter Amstutz
|Final|invalid|invalid|
79 1 Peter Amstutz
80 7 Peter Amstutz
When a container request goes to the "committed" state, it is assigned a container.
81
82 1 Peter Amstutz
Container:
83 6 Peter Amstutz
84
||priority == 0|priority > 0|
85
|Queued|Desire change state to "Cancelled"|Desire to change change state to "Running"|
86
|Running|Desire change state to "Cancelled"|nothing|
87
|Complete|invalid|invalid|
88
|Cancelled|invalid|invalid|
89 7 Peter Amstutz
90
When the container goes to either the "complete" or "cancelled" state, any associated container requests go to "final" state.
91 8 Peter Amstutz
92
h2. Claims
93
94
Have a field "claimed_by_uuid" on the Container record.  A queued container is claimed by a dispatcher process via an atomic "claim" operation.  A claim can be released if the container is still in the Queued state.
95
96
The container record cannot be updated by anyone except the owner of the claim.