Worker activities statistics endpoint
Closes #711 (closed)
Merge request reports
Activity
added 15 commits
-
ed0dd197...85f21724 - 14 commits from branch
master
- ad77d2e4 - Base activities endpoint
-
ed0dd197...85f21724 - 14 commits from branch
added 8 commits
-
ad77d2e4...9392dd5b - 4 commits from branch
master
- 203370b8 - Base activities endpoint
- 93f16ec8 - Use a serializer
- c3c1653e - Add total elements count
- 437c0292 - Add tests
Toggle commit list-
ad77d2e4...9392dd5b - 4 commits from branch
requested review from @babadie
@babadie I updated the code following your suggestion (no raw SQL), it seems much better. It takes approx. 2.5s for
4 693 915
existing WorkerActivity on my setup, for a single corpus and version.I'll have a look on retrieving all activities for a corpus tomorrow morning
Edited by Valentin RigalRetrieving all the activities on elements for a corpus is possible and easy to do in raw SQL. Request execution time seems linear to the total number of worker activity in my case (approx 1.5s + 0.2s/million, a bit slower when states are balanced).
However, it will be hard to implement using django ORM as it requires a custom
GROUP BY
.SELECT "dataimport_workeractivity"."worker_version_id", (COALESCE(SUM(CASE WHEN state = 'queued' THEN 1 ELSE 0 END), 0)) AS "queued", (COALESCE(SUM(CASE WHEN state = 'started' THEN 1 ELSE 0 END), 0)) AS "started", (COALESCE(SUM(CASE WHEN state = 'processed' THEN 1 ELSE 0 END), 0)) AS "processed", (COALESCE(SUM(CASE WHEN state = 'error' THEN 1 ELSE 0 END), 0)) AS "error" FROM "dataimport_workeractivity" WHERE "dataimport_workeractivity"."element_id" IN ( SELECT U0."id" FROM "documents_element" U0 WHERE U0."corpus_id" = 'cde11c80-9d98-474d-ad63-a07f11a6ad27'::uuid ) GROUP BY ("dataimport_workeractivity"."worker_version_id")
Edited by Valentin Rigaladded 2 commits
added 16 commits
-
47ae5815...36ce4841 - 8 commits from branch
master
- 7c3d9702 - Base activities endpoint
- 4de7f991 - Use a serializer
- e6b384b9 - Add total elements count
- 9be95f1c - Add tests
- 3f8df24b - Suggestion
- ff9bf20d - Update tests as the stats query is counted
- 55b5af44 - Update the view to list all activities
- 6dc1bf01 - Update tests
Toggle commit list-
47ae5815...36ce4841 - 8 commits from branch
added 9 commits
-
d12f0717 - 1 commit from branch
master
- 17b2dd4a - Base activities endpoint
- 89331d4f - Use a serializer
- d661fd4e - Add total elements count
- aafcbdc3 - Add tests
- 4c4d0117 - Suggestion
- 332cc575 - Update tests as the stats query is counted
- 72189902 - Update the view to list all activities
- db1e9e71 - Update tests
Toggle commit list-
d12f0717 - 1 commit from branch
added 12 commits
-
db1e9e71...79f346a6 - 4 commits from branch
master
- a8f0173a - Base activities endpoint
- a85b953c - Use a serializer
- c4324575 - Add total elements count
- 267c779e - Add tests
- d7342196 - Suggestion
- 4ed00de6 - Update tests as the stats query is counted
- 4ac7133f - Update the view to list all activities
- d1fd3c65 - Update tests
Toggle commit list-
db1e9e71...79f346a6 - 4 commits from branch
added 14 commits
-
d1fd3c65...30fb3a2e - 6 commits from branch
master
- 86517d77 - Base activities endpoint
- 9f10da7e - Use a serializer
- 500587c2 - Add total elements count
- 7e7bc38b - Add tests
- acfe784a - Suggestion
- c39fb1d3 - Update tests as the stats query is counted
- 2d5b042d - Update the view to list all activities
- 348c7a60 - Update tests
Toggle commit list-
d1fd3c65...30fb3a2e - 6 commits from branch
mentioned in merge request frontend!905 (merged)
added 12 commits
-
348c7a60...5998b255 - 4 commits from branch
master
- 82df8050 - Base activities endpoint
- 64d7086e - Use a serializer
- ad719345 - Add total elements count
- b6729fbd - Add tests
- fc064d92 - Suggestion
- ebd7197c - Update tests as the stats query is counted
- 91641c7a - Update the view to list all activities
- dbe30b32 - Update tests
Toggle commit list-
348c7a60...5998b255 - 4 commits from branch
added 14 commits
-
dbe30b32...a491dfd7 - 6 commits from branch
master
- cd0e071e - Base activities endpoint
- d0b478c6 - Use a serializer
- 6dadf450 - Add total elements count
- 2cf577fb - Add tests
- cb9fa589 - Suggestion
- 775811a4 - Update tests as the stats query is counted
- 7af70cdd - Update the view to list all activities
- ca6d5472 - Update tests
Toggle commit list-
dbe30b32...a491dfd7 - 6 commits from branch