Skip to content

Commit 7530a75

Browse files
authored
Added task lifecycle graph (#4345)
1 parent d9410d2 commit 7530a75

3 files changed

Lines changed: 82 additions & 0 deletions

File tree

taskvine/src/manager/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,9 @@ lint:
6565
format:
6666
clang-format -i $(SOURCES)
6767

68+
# Note that this rule is not invoked by default, since this is
69+
# developer documentation and dot is not required for production build.
70+
task-lifecycle.png: task-lifecycle.dot
71+
dot -Tpng task-lifecycle.dot > task-lifecycle.png
72+
6873
.PHONY: all clean install test lint format
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
digraph g {
2+
3+
overlap=scale;
4+
5+
/*
6+
A task is created by vine_task_create() in the INITIAL
7+
state, and then moves to the READY state via vine_submit().
8+
*/
9+
10+
INITIAL -> READY [label="submit"];
11+
12+
/*
13+
A task goes to the RUNNING state when it is dispatched
14+
from the manager to a worker. Note that the manager
15+
does not know exactly when the worker does a fork/exec
16+
to invoke the task on its end.
17+
*/
18+
19+
READY -> RUNNING [label="dispatch"];
20+
21+
/*
22+
When the worker observes that a task has exited
23+
(or fails to start correctly) it sends a "complete"
24+
message to the manager with the essential task status.
25+
The task is now waiting for the manager to retrieve
26+
any large outputs and then delete the task.
27+
*/
28+
29+
RUNNING -> WAITING_RETRIEVAL [label="complete"];
30+
31+
/*
32+
If a task is dispatched to a worker, and then the
33+
worker fails prior to completion, the task goes
34+
back into the ready state. Likewise if the task
35+
is complete but not retrieved, it goes back to ready.
36+
*/
37+
38+
RUNNING -> READY [label="failure"];
39+
WAITING_RETRIEVAL -> READY [label="failure"];
40+
41+
/*
42+
Once the manager fetches the full outputs of a task
43+
it sends a "kill" to the worker to delete the remote
44+
state, and the task is now in the retrieved state,
45+
until the user waits for its output.
46+
*/
47+
48+
WAITING_RETRIEVAL -> RETRIEVED [label="fetch"];
49+
50+
/*
51+
When the user calls vine_wait(), the manager picks
52+
a task out of the retrieved list, and returns it
53+
to the user, at which point it is DONE and the
54+
manager has no further responsibility for it.
55+
*/
56+
57+
RETRIEVED -> DONE [label="vine_wait"];
58+
59+
/*
60+
Cancellation moves a task in any state to the retrieved state,
61+
where it is handled like a completed task and returned to the user.
62+
*/
63+
64+
READY->RETRIEVED [label="cancel"];
65+
RUNNING->RETRIEVED [label="cancel"];
66+
WAITING_RETRIEVAL->RETRIEVED [label="cancel"];
67+
68+
/*
69+
A task that is permanently unable to run
70+
(for example, its expiration time has been exceeded)
71+
will go directly to RETRIEVED so that it can be
72+
collected by the user.
73+
*/
74+
75+
READY->RETRIEVED [label="unable"];
76+
77+
}
62.4 KB
Loading

0 commit comments

Comments
 (0)