Project

General

Profile

API HistoricalForcasting data for CR » History » Version 5

Nico César, 06/24/2020 09:03 PM

1 1 Nico César
h1. API Historical/Forcasting data for CR
2
3
Goal: create a pipeline forecaster and visualization for historical data. This should expose APIs that can be used in the ContainerRequest visualization and 
4
also could be use to provide extra information for the current running CR
5
6
Glossary:
7
8 3 Nico César
* Checkpoint: is a generic name that currently corresponds to a step name. This id together with "family" make a unique cluster to summarize results. This summarization for the unique cluster includes: a) several runs with similar parameters and b) scattered steps that have the pattern: name_2, name_3,..., name_229
9 1 Nico César
10 3 Nico César
* Family: A common name like "gatk" or "haplotypecaller" can be used as a step name. The family definition will help to separate the 2 populationsn terms of checkpoints. We think that implementing this based the parameters of CommandLineTool and parent workflow md5sum or a combination of both
11 1 Nico César
12 2 Nico César
* Datapoint: a concrete data that can be plotted as historical data. Currently we're bounding together the container request and the associated container to have a unified view of the times involved. This should not get confused with forecast data since can be used separately
13 1 Nico César
14
h2. API 
15
16 5 Nico César
The "checkpoints" endpoint is where the stadistics that will be used as forecasting. Right now as an example we'll start with time_* keys, but in the future this will expose all the data needed to do an acurate forecast.
17
18 1 Nico César
GET /container-request/aaaaa-xvhdp-123456789abc/checkpoints
19
20
Output:
21
22
<pre>
23
{
24
  "checkpoints": [
25
    {
26 3 Nico César
      "name": "merge-tilelib",
27
      "family": "family22",
28 1 Nico César
      "dependencies": [
29
        "createsglf"
30
      ],
31
      "time_average": 8254.534873,
32
      "time_count": 1,
33
      "time_min": 8254.534873,
34
      "time_min_comment": "duration:merge-tilelib#su92l-dz642-cc7799yfwi5jmd9",
35
      "time_max": 8254.534873,
36
      "time_max_comment": "duration:merge-tilelib#su92l-dz642-cc7799yfwi5jmd9"
37
    },
38
    {
39 3 Nico César
      "name": "createsglf",
40
      "family": "family9",
41 1 Nico César
      "dependencies": [],
42
      "time_average": 4741.290203,
43
      "time_count": 58,
44
      "time_min": 82.138309,
45
      "time_min_comment": "duration:createsglf_57#su92l-dz642-3u3g4bq1yh4pqje",
46
      "time_max": 5818.898387,
47
      "time_max_comment": "duration:createsglf_8#su92l-dz642-8d094xhqciin5m2"
48
    },
49
...
50
],
51
"time_average": <average time for the CR family>,
52
</pre>
53
54
55
GET /container-request/aaaaa-xvhdp-123456789abc/datapoints
56
57
Output:
58
59
<pre>
60
[
61
  {
62
    "step_name": "createsglf",
63
    "start_1": "2020-01-15 19:49:34.213 +0000",
64
    "end_1": "2020-01-15 21:19:39.001 +0000",
65
    "start_2": "2020-01-15 19:54:44.864 +0000",
66
    "end_2": "2020-01-15 21:19:39.001 +0000",
67
    "reuse": false,
68
    "status": "completed",
69
    "legend": "<p>createsglf</p><p>Container Request: <a href=\"https://workbench.su92l.arvadosapi.com/container_requests/su92l-xvhdp-zfc3ffxk3slmkzv\">su92l-xvhdp-zfc3ffxk3slmkzv</a></p><p>Container duration: 1h24m54.137122s\n</p>"
70
  },
71
  {
72
    "step_name": "createsglf_2",
73
    "start_1": "2020-01-15 19:49:34.288 +0000",
74
    "end_1": "2020-01-15 21:29:11.399 +0000",
75
    "start_2": "2020-01-15 19:54:51.275 +0000",
76
    "end_2": "2020-01-15 21:29:11.399 +0000",
77
    "reuse": false,
78
    "status": "completed",
79
    "legend": "<p>createsglf_2</p><p>Container Request: <a href=\"https://workbench.su92l.arvadosapi.com/container_requests/su92l-xvhdp-py99va9hnvuxzp5\">su92l-xvhdp-py99va9hnvuxzp5</a></p><p>Container duration: 1h34m20.123849s\n</p>"
80
  },
81
....
82
</pre>
83
84
GET /container-request/aaaaa-xvhdp-123456789abc/workflow-dot
85
86
Output:
87
88
<pre>
89
digraph cwlgraph {
90
rankdir=LR;
91
graph [compound=true];
92
93
subgraph cluster_0 {
94
label="#createcgf-wf.cwl";
95
node [style=filled];
96
shape=box
97
style="filled";
98
color="#dddddd";
99
"#createcgf-wf.cwl" [ label = "#createcgf-wf.cwl", style = invis ];
100
....
101
</pre>
102
103
h2. Frontend
104
105
Dot file can be rendered with  https://domparfitt.com/graphviz-react/ we already tested some big files 
106
107
h2. Schema and queries on the postgres DB 
108
109
TODO: Outline the transformation from the current local leveldb cache to some per-user caching table.  
110
TODO: list the queries to INSERT and SELECT the data for a particular checkpoint. 
111
112
113
h2. Permissions
114
115
One concern is permissions. we'll behave similar to everything else in Arvados: if it's a CR that the token doesn't have access to, then is a 404. This includes the idea of "sumarized data" as in the historical time and prices of the CRs 
116 3 Nico César
117
h2. Real World Example
118
119
Take the case of su92l-xvhdp-bs4tseq26te2bnz ( a hasher function that Ops usually use as smoke test)
120
121
h3. graph
122
123
!su92l-xvhdp-bs4tseq26te2bnz.png!
124
125
the dotty representation would be:
126
127
<pre>
128
digraph cwlgraph {
129
rankdir=LR;
130
graph [compound=true];
131
132
subgraph cluster_0 {
133
label="#main";
134
node [style=filled];
135
shape=box
136
style="filled";
137
color="#dddddd";
138
"#main" [ label = "#main", style = invis ];
139
140
141
"#main
142
inputfile" -> "step #main
143
hasher1";
144
"#main
145
hasher1_outputname" -> "step #main
146
hasher1";
147
"step #main
148
hasher1" -> "#main
149
hasher1
150
hasher_out";
151
"#main
152
hasher1
153
hasher_out" -> "step #main
154
hasher2";
155
"#main
156
hasher2_outputname" -> "step #main
157
hasher2";
158
"step #main
159
hasher2" -> "#main
160
hasher2
161
hasher_out";
162
"#main
163
hasher2
164
hasher_out" -> "step #main
165
hasher3";
166
"#main
167
hasher3_outputname" -> "step #main
168
hasher3";
169
"step #main
170
hasher3" -> "#main
171
hasher3
172
hasher_out";
173
}
174
175
176
177
"step #main
178
hasher1" [fillcolor="#FFD700", style="rounded,filled", shape=box];
179
"step #main
180
hasher2" [fillcolor="#FFD700", style="rounded,filled", shape=box];
181
"step #main
182
hasher3" [fillcolor="#FFD700", style="rounded,filled", shape=box];
183
"#hasher.cwl" [fillcolor="#FF9912", style="rounded,filled", shape=box];
184
185
186
"step #main
187
hasher1" -> "#hasher.cwl" [label="runs", style="dashed"];
188
"step #main
189
hasher2" -> "#hasher.cwl" [label="runs", style="dashed"];
190
"step #main
191
hasher3" -> "#hasher.cwl" [label="runs", style="dashed"];
192
}</pre>
193
194
h3. datapoints
195 1 Nico César
196 4 Nico César
<pre>
197 3 Nico César
[
198
  {
199
    "checkpoint": "hasher1",
200
    "start_1": "2020-05-12 16:35:33.594 +0000",
201
    "end_1": "2020-05-12 16:37:30.597 +0000",
202
    "start_2": "2020-05-12 16:37:27.893 +0000",
203
    "end_2": "2020-05-12 16:37:30.597 +0000",
204
    "reuse": false,
205
    "legend": "<p>hasher1</p><p>Container Request: <a href=\"https://workbench.su92l.arvadosapi.com/container_requests/su92l-xvhdp-pbpkli9qovdo4q8\">su92l-xvhdp-pbpkli9qovdo4q8</a></p><p>Container duration: 2.70491s\n</p>"
206
  },
207
  {
208
    "checkpoint": "hasher2",
209
    "start_1": "2020-05-12 16:37:33.673 +0000",
210
    "end_1": "2020-05-12 16:39:56.562 +0000",
211
    "start_2": "2020-05-12 16:39:51.455 +0000",
212
    "end_2": "2020-05-12 16:39:56.562 +0000",
213
    "reuse": false,
214
    "legend": "<p>hasher2</p><p>Container Request: <a href=\"https://workbench.su92l.arvadosapi.com/container_requests/su92l-xvhdp-l8je8tws556fqcp\">su92l-xvhdp-l8je8tws556fqcp</a></p><p>Container duration: 5.10645s\n</p>"
215
  },
216
  {
217
    "checkpoint": "hasher3",
218
    "start_1": "2020-05-12 16:39:57.608 +0000",
219
    "end_1": "2020-05-12 16:42:17.628 +0000",
220
    "start_2": "2020-05-12 16:42:14.836 +0000",
221
    "end_2": "2020-05-12 16:42:17.628 +0000",
222
    "reuse": false,
223
    "legend": "<p>hasher3</p><p>Container Request: <a href=\"https://workbench.su92l.arvadosapi.com/container_requests/su92l-xvhdp-jx5vk6lq26dsbba\">su92l-xvhdp-jx5vk6lq26dsbba</a></p><p>Container duration: 2.792018s\n</p>"
224
  }
225
]</pre>
226
227
228
h3. checkpoints
229
230
<pre>
231
{
232
  "checkpoints": [
233
    {
234
      "name": "hasher2",
235
      "family": "abde1234-9876543",
236
      "dependencies": [
237
        "hasher1"
238
      ],
239
      "time_average": 5.10645,
240
      "time_count": 1,
241
      "time_min": 5.10645,
242
      "time_min_comment": "duration:hasher2#su92l-dz642-eouma4xv1qpnhvc",
243
      "time_max": 5.10645,
244
      "time_max_comment": "duration:hasher2#su92l-dz642-eouma4xv1qpnhvc"
245
    },
246
    {
247
      "name": "hasher3",
248
      "family": "87654321-fedcba01",
249
      "dependencies": [
250
        "hasher2"
251
      ],
252
      "time_average": 2.792018,
253
      "time_count": 1,
254
      "time_min": 2.792018,
255
      "time_min_comment": "duration:hasher3#su92l-dz642-tn9t07438jd1zrt",
256
      "time_max": 2.792018,
257
      "time_max_comment": "duration:hasher3#su92l-dz642-tn9t07438jd1zrt"
258
    },
259
    {
260
      "name": "hasher1",
261
      "family": "deadbeef-deafbeef",
262
      "dependencies": [],
263
      "time_average": 2.70491,
264
      "time_count": 1,
265
      "time_min": 2.70491,
266
      "time_min_comment": "duration:hasher1#su92l-dz642-e6d8emz3ez54owu",
267
      "time_max": 2.70491,
268
      "time_max_comment": "duration:hasher1#su92l-dz642-e6d8emz3ez54owu"
269
    }
270
  ]
271
}
272
</pre>