OILS / regtest / aports / tasks.sql View on Github | oils.pub

44 lines, 36 significant
1-- SQL invoked from regtest/aports-html.sh
2
3-- annoying: you have to cast(x as real) for pragma_info to have type info
4create table packages as
5 select
6 status,
7 elapsed_secs,
8 cast(user_secs / elapsed_secs as real) as user_elapsed_ratio,
9 cast(user_secs / sys_secs as real) as user_sys_ratio,
10 cast(max_rss_KiB * 1024 / 1e6 as real) as max_rss_MB,
11 pkg,
12 pkg_HREF
13 from tasks;
14
15-- Compute stats
16
17create table metrics (
18 id integer primary key check (id = 1), -- ensure only one row
19 elapsed_minutes real not null,
20 num_failures integer not null,
21 num_timeouts integer not null,
22 num_tasks integer not null,
23 -- filled in later
24 num_apk integer not null
25);
26
27-- dummy row
28insert into metrics values (1, -1.0, -1, -1, -1, -1);
29
30update metrics
31set elapsed_minutes = (select (max(end_time) - min(start_time)) / 60 from tasks)
32where id = 1;
33
34update metrics
35set num_failures = (select count(*) from tasks where status != 0)
36where id = 1;
37
38update metrics
39set num_timeouts = (select count(*) from tasks where status in (124, 143))
40where id = 1;
41
42update metrics
43set num_tasks = (select count(*) from tasks)
44where id = 1;