19624: Layout graph L->R, say "update" instead of "assign".
[arvados.git] / doc / api / methods / container_requests.html.textile.liquid
index 11f4f34fc83648347d7522c69c67337bec410ed9..869e22d855968ed13b7b8bdf512395e8986a444f 100644 (file)
@@ -54,7 +54,7 @@ table(table table-bordered table-condensed).
 |priority|integer|Range 0-1000.  Indicate scheduling order preference.|Clients are expected to submit container requests with zero priority in order to preview the container that will be used to satisfy it. Priority can be null if and only if state!="Committed".  See "below for more details":#priority .|
 |expires_at|datetime|After this time, priority is considered to be zero.|Not yet implemented.|
 |use_existing|boolean|If possible, use an existing (non-failed) container to satisfy the request instead of creating a new one.|Default is true|
-|log_uuid|string|Log collection containing log messages provided by the scheduler and crunch processes.|Null if the container has not yet completed.|
+|log_uuid|string|Log collection containing log messages provided by the scheduler and crunch processes.|Null if the container has not yet started running.|
 |output_uuid|string|Output collection created when the container finished successfully.|Null if the container has failed or not yet completed.|
 |filters|string|Additional constraints for satisfying the container_request, given in the same form as the filters parameter accepted by the container_requests.list API.|
 |runtime_token|string|A v2 token to be passed into the container itself, used to access Keep-backed mounts, etc.  |Not returned in API responses.  Reset to null when state is "Complete" or "Cancelled".|
@@ -64,6 +64,53 @@ table(table table-bordered table-condensed).
 |output_properties|hash|User metadata properties to set on the output collection.  The output collection will also have default properties "type" ("intermediate" or "output") and "container_request" (the uuid of container request that produced the collection).|
 |cumulative_cost|number|Estimated cost of the cloud VMs used to satisfy the request, including retried attempts and completed subrequests, but not including reused containers.|0 if container was reused or VM price information was not available.|
 
+h2(#lifecycle). Container request lifecycle
+
+A container request may be created in the Committed state, or created in the Uncommitted state and then moved into the Committed state.
+
+Once a request is in the Committed state, Arvados locates a suitable existing container or schedules a new one. When the assigned container finishes, the request state changes to Final.
+
+A client may cancel a committed request early (before the assigned container finishes) by setting the request priority to zero.
+
+!{max-width:40em;max-height:70em}{{site.baseurl}}/api/methods/container_request_lifecycle.svg!
+{% comment %}
+# svg generated using https://dreampuf.github.io/
+digraph {
+    graph [nojustify=true] [labeljust=l];
+
+    invisiblestart [label = ""] [color=white];
+    node [color=black] [fillcolor=white] [style=filled] [shape=box] [nojustify=true];
+    uncommitted [label = "container request:\l   state=Uncommitted\l"] [fillcolor=lightgrey];
+    committed [label = "container request:\l   state=Committed\l   priority>0\l"];
+    invisiblestart -> uncommitted [label = "user creates container request"] [color=navy] [fontcolor=navy];
+    uncommitted -> committed [label = "user updates to\lstate=Committed, priority>0\l"] [color=navy] [fontcolor=navy];
+    queued [label = "container request:\l   state=Committed\l   priority>0\lcontainer:\l   state=Queued\l"];
+    committed -> queued [label = "Arvados creates\la new container\l"];
+    locked [label = "container request:\l   state=Committed\l   priority>0\lcontainer:\l   state=Locked\l"];
+    queued -> locked [label = "Arvados is ready\lto dispatch the container\l"];
+    running [label = "container request:\l   state=Committed\l   priority>0\lcontainer:\l   state=Running\l"];
+    locked -> running [label = "Arvados starts the\lcontainer process\l"];
+
+    node [color=black] [fillcolor=lightblue] [style=filled] [shape=box];
+    reused [label = "container request:\l   state=Final\lcontainer:\l   state=Complete\l(reused existing container)\l"];
+    latecancelled [label = "container request:\l   state=Final\lcontainer:\l   state=Cancelled\l"];
+    containerfinished [label = "container request:\l   state=Final\lcontainer:\l   state=Complete\l   exit_code=0\l"];
+    containerfailed [label = "container request:\l   state=Final\lcontainer:\l   state=Complete\l   exit_codeā‰ 0\l"];
+
+    committed -> reused [label = "Arvados selects an\lexisting container\l"];
+    queued -> latecancelled [label = "user updates to\lpriority=0\l"] [color=navy] [fontcolor=navy];
+    locked -> latecancelled [label = "user updates to\lpriority=0\l"] [color=navy] [fontcolor=navy];
+    running -> latecancelled [label = "user updates to\lpriority=0\l"] [color=navy] [fontcolor=navy];
+    running -> containerfailed [label = "container process\lfails\l"];
+    running -> containerfinished [label = "container process\lsucceeds\l"];
+
+    # layout hacks
+    committed -> containerfinished [style=invis];
+    uncommitted -> latecancelled [style=invis];
+    reused -> latecancelled [style=invis];
+}
+{% endcomment %}
+
 h2(#priority). Priority
 
 The @priority@ field has a range of 0-1000.
@@ -99,7 +146,7 @@ h2(#cancel_container). Canceling a container request
 
 A container request may be canceled by setting its priority to 0, using an update call.
 
-When a container request is canceled, it will still reflect the state of the Container it is associated with via the container_uuid attribute. If that Container is being reused by any other container_requests that are still active, i.e., not yet canceled, that Container may continue to run or be scheduled to run by the system in future. However, if no other container_requests are using that Contianer, then the Container will get canceled as well.
+When a container request is canceled, it will still reflect the state of the Container it is associated with via the container_uuid attribute. If that Container is being reused by any other container_requests that are still active, i.e., not yet canceled, that Container may continue to run or be scheduled to run by the system in future. However, if no other container_requests are using that Container, then the Container will get canceled as well.
 
 h2. Methods