From d49adbf6b8e6a380aef67bd8231b5d141e813151 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 19:03:48 +0200 Subject: [PATCH 01/11] - [X] Simplify json parsing --- TODO.org | 5 ++++- celery.el | 12 +----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/TODO.org b/TODO.org index ef1d737..711d65e 100644 --- a/TODO.org +++ b/TODO.org @@ -1,7 +1,10 @@ #+title: backlog #+author: ardumont -* TODO 0.0.3 [%] +* IN-PROGRESS 0.0.3 [20%] +- [X] Simplify json parsing +- [ ] Fix potential total sum problem +- [ ] Simplify data model representation - [ ] Deliver to melpa - [ ] Deliver to el-get diff --git a/celery.el b/celery.el index 7cd5492..4202d35 100644 --- a/celery.el +++ b/celery.el @@ -84,11 +84,7 @@ Mostly to work offline.") (defun celery-compute-full-stats-workers () "Compute the worker' stats in json data structure." - (let ((stats-json-str-output (celery--compute-json-string-stats))) - (with-temp-buffer - (insert stats-json-str-output) - (goto-char (point-min)) - (json-read)))) + (json-read-from-string (celery--compute-json-string-stats))) (defun celery-total-tasks-per-worker (stats worker) "Compute the total number of tasks from STATS for WORKER." @@ -235,12 +231,6 @@ if REFRESH is mentioned, trigger a check, otherwise, use the latest value." ;;;###autoload (define-minor-mode celery-mode - - - - - - "Minor mode to consolidate Emacs' celery extensions. \\{celery-mode-map}" From 6c471e185d38769b18749a78f0a70cd6825f2684 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 19:04:14 +0200 Subject: [PATCH 02/11] temp --- test/celery-test.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/celery-test.el b/test/celery-test.el index e3b6b9c..fcb9a86 100644 --- a/test/celery-test.el +++ b/test/celery-test.el @@ -221,10 +221,11 @@ (celery-full-stats-count-processes-per-worker stats 'w02)))) (ert-deftest test-celery-full-stats-total-tasks-per-worker () - (should (equal 27113 (celery-full-stats-total-tasks-per-worker - '((w01 (total - (swh\.worker\.tasks\.do_something_awesome . 27113)))) - 'w01))) + (should (equal 3000 (celery-full-stats-total-tasks-per-worker + '((w01 (total + (do_something_awesome . 27000) + (do_awesomer_stuff . 3000)))) + 'w01))) (should-not (celery-full-stats-total-tasks-per-worker '((w01 (total (swh\.worker\.tasks\.do_something_awesome . 27113)))) From 9d8d395c2fa9194d2c8a0f95379421f8a9f4c1f4 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 19:14:48 +0200 Subject: [PATCH 03/11] - [X] Fix total tasks problems when multiple tasks multiple different tasks per worker --- TODO.org | 4 ++-- celery.el | 12 ++++++------ test/celery-test.el | 11 ++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/TODO.org b/TODO.org index 711d65e..7b210f7 100644 --- a/TODO.org +++ b/TODO.org @@ -1,9 +1,9 @@ #+title: backlog #+author: ardumont -* IN-PROGRESS 0.0.3 [20%] +* IN-PROGRESS 0.0.3 [40%] - [X] Simplify json parsing -- [ ] Fix potential total sum problem +- [X] Fix total tasks done problems when multiple tasks - [ ] Simplify data model representation - [ ] Deliver to melpa - [ ] Deliver to el-get diff --git a/celery.el b/celery.el index 4202d35..808175e 100644 --- a/celery.el +++ b/celery.el @@ -135,19 +135,19 @@ Mostly to work offline.") (defun celery-full-stats-count-processes-per-worker (full-stats worker) "Access processes stats from FULL-STATS for the WORKER." - (-when-let (w (assoc-default worker full-stats)) - (->> w + (-when-let (worker-stats (assoc-default worker full-stats)) + (->> worker-stats (assoc-default 'pool) (assoc-default 'processes) length))) (defun celery-full-stats-total-tasks-per-worker (full-stats worker) "Compute the total number of tasks from FULL-STATS for WORKER." - (-when-let (w (assoc-default worker full-stats)) - (->> w + (-when-let (worker-stats (assoc-default worker full-stats)) + (->> worker-stats (assoc-default 'total) - car - cdr))) + (mapcar #'cdr) + (apply #'+)))) (defun celery-simplify-stats (full-stats) "Compute the number of total tasks done per worker from the FULL-STATS." diff --git a/test/celery-test.el b/test/celery-test.el index fcb9a86..9b21e83 100644 --- a/test/celery-test.el +++ b/test/celery-test.el @@ -221,11 +221,12 @@ (celery-full-stats-count-processes-per-worker stats 'w02)))) (ert-deftest test-celery-full-stats-total-tasks-per-worker () - (should (equal 3000 (celery-full-stats-total-tasks-per-worker - '((w01 (total - (do_something_awesome . 27000) - (do_awesomer_stuff . 3000)))) - 'w01))) + (should (equal 30000 (celery-full-stats-total-tasks-per-worker + '((w01 (total + (do_something_awesome . 27000) + (do_awesomer_stuff . 2000) + (yet_another_task . 1000)))) + 'w01))) (should-not (celery-full-stats-total-tasks-per-worker '((w01 (total (swh\.worker\.tasks\.do_something_awesome . 27113)))) From 0c38f5c98912d1a3adc10daf9d686cd5f05f59a7 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 19:31:02 +0200 Subject: [PATCH 04/11] Remove dead code --- test/celery-test.el | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/celery-test.el b/test/celery-test.el index 9b21e83..b249dab 100644 --- a/test/celery-test.el +++ b/test/celery-test.el @@ -184,16 +184,6 @@ (let ((celery-last-known-stats :old-stats)) (celery--compute-stats-workers-with-refresh 'with-refresh)))))) -;; (ert-deftest test-celery--with-delay-apply () -;; (with-mock -;; (mock (celery--compute-stats-workers-with-refresh) => :stats) -;; (mock (celery-simplify-stats :stats) => :simplified-stats) -;; (celery--with-delay-apply -;; (lambda (stats) -;; (message "stats: %s" stats) -;; (should (equal :simplified-stats stats)))))) -;; does not work - (ert-deftest test-celery-all-tasks-consumed () (should (equal 6000 (celery-all-tasks-consumed '((worker02 (:total . 3600) (:processes . 2)) From a0a33a497677dfc26330ba489ba9d05e4240e315 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 19:49:27 +0200 Subject: [PATCH 05/11] - [X] Add group for customization group --- TODO.org | 8 ++++---- celery.el | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/TODO.org b/TODO.org index 7b210f7..803ebd7 100644 --- a/TODO.org +++ b/TODO.org @@ -1,12 +1,12 @@ #+title: backlog #+author: ardumont -* IN-PROGRESS 0.0.3 [40%] +* IN-PROGRESS 0.0.3 [60%] - [X] Simplify json parsing - [X] Fix total tasks done problems when multiple tasks -- [ ] Simplify data model representation -- [ ] Deliver to melpa -- [ ] Deliver to el-get +- [X] Add group for customization group +- [ ] melpa +- [ ] el-get * DONE 0.0.2 [100%] CLOSED: [2015-08-08 Sat 11:33] diff --git a/celery.el b/celery.el index 808175e..158c590 100644 --- a/celery.el +++ b/celery.el @@ -47,15 +47,22 @@ (require 'json) (require 's) +(defgroup celery nil " Celery customisation group." + :tag "Celery" + :version "0.0.3" + :group 'celery) + (defcustom celery-command "celery" "The celery command in charge of outputing the result this mode parse. The user can override this. For example, if a remote machine only knows celery, it could be defined as: -\(custom-set-variables '\(celery-command \"ssh remote-node celery\"\)\)") +\(custom-set-variables '\(celery-command \"ssh remote-node celery\"\)\)" + :group 'celery) (defcustom celery-workers-list nil "If non nil, filter the stats according to the content of this list. -This is a list of worker names.") +This is a list of worker names." + :group 'celery) (defvar celery-last-known-stats nil "Latest worker stats. From 9d70b6fbd92778148ee62809bb2637420263f7ab Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 20:07:38 +0200 Subject: [PATCH 06/11] - [X] melpa - PR milkypostman/melpa#3002 --- TODO.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO.org b/TODO.org index 803ebd7..28bcd41 100644 --- a/TODO.org +++ b/TODO.org @@ -1,11 +1,11 @@ #+title: backlog #+author: ardumont -* IN-PROGRESS 0.0.3 [60%] +* IN-PROGRESS 0.0.3 [80%] - [X] Simplify json parsing - [X] Fix total tasks done problems when multiple tasks - [X] Add group for customization group -- [ ] melpa +- [X] melpa - https://github.com/milkypostman/melpa/pull/3002 - [ ] el-get * DONE 0.0.2 [100%] From 256576b485825b89996884aac1df65f7d24fb728 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 20:55:33 +0200 Subject: [PATCH 07/11] - [X] el-get - PR dimitri/el-get#2230 --- TODO.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TODO.org b/TODO.org index 28bcd41..824c612 100644 --- a/TODO.org +++ b/TODO.org @@ -1,12 +1,13 @@ #+title: backlog #+author: ardumont -* IN-PROGRESS 0.0.3 [80%] +* IN-PROGRESS 0.0.3 [100%] - [X] Simplify json parsing - [X] Fix total tasks done problems when multiple tasks - [X] Add group for customization group - [X] melpa - https://github.com/milkypostman/melpa/pull/3002 -- [ ] el-get +- [X] el-get - https://github.com/dimitri/el-get/pull/2230 +- [ ] Release notes * DONE 0.0.2 [100%] CLOSED: [2015-08-08 Sat 11:33] From 8038036b156f3b00be38225faa0d79c222ebdca1 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 20:56:12 +0200 Subject: [PATCH 08/11] - [X] Release notes --- TODO.org | 2 +- release-notes.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index 824c612..b228f53 100644 --- a/TODO.org +++ b/TODO.org @@ -7,7 +7,7 @@ - [X] Add group for customization group - [X] melpa - https://github.com/milkypostman/melpa/pull/3002 - [X] el-get - https://github.com/dimitri/el-get/pull/2230 -- [ ] Release notes +- [X] Release notes * DONE 0.0.2 [100%] CLOSED: [2015-08-08 Sat 11:33] diff --git a/release-notes.md b/release-notes.md index 79d6a24..6a8fc8c 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,3 +1,12 @@ +# 0.0.3 + +- [X] Simplify json parsing +- [X] Fix total tasks done problems when multiple tasks +- [X] Add group for customization group +- [X] melpa - https://github.com/milkypostman/melpa/pull/3002 +- [X] el-get - https://github.com/dimitri/el-get/pull/2230 +- [X] Release notes + # 0.0.2 - [X] Fix release script error From 5063a793ce1855b45acb2e1c244c24e87f80bdb3 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 20:56:22 +0200 Subject: [PATCH 09/11] * DONE 0.0.3 [100%] --- TODO.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index b228f53..209816f 100644 --- a/TODO.org +++ b/TODO.org @@ -1,7 +1,8 @@ #+title: backlog #+author: ardumont -* IN-PROGRESS 0.0.3 [100%] +* DONE 0.0.3 [100%] +CLOSED: [2015-08-08 Sat 20:56] - [X] Simplify json parsing - [X] Fix total tasks done problems when multiple tasks - [X] Add group for customization group From dce4bf943b922860fd058a97ec6b0f4f95aba7dd Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 22:09:45 +0200 Subject: [PATCH 10/11] Add some tests + fix one bad named test --- test/celery-test.el | 78 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/test/celery-test.el b/test/celery-test.el index b249dab..386f0f6 100644 --- a/test/celery-test.el +++ b/test/celery-test.el @@ -3,9 +3,81 @@ (require 'celery) +(ert-deftest test-celery--compute-json-string-stats () + (should (string= "{ + \"worker02\": + { + \"broker\": { + \"alternates\": [], + \"connect_timeout\": 4, + \"heartbeat\": null, + \"hostname\": \"moma\", + \"insist\": false, + \"login_method\": \"AMQPLAIN\", + \"port\": 5672, + \"ssl\": false, + \"transport\": \"amqp\", + \"transport_options\": {}, + \"uri_prefix\": null, + \"userid\": \"guest\", + \"virtual_host\": \"/\" + }, + \"clock\": \"403897\", + \"pid\": 14216, + \"pool\": { + \"max-concurrency\": 1, + \"max-tasks-per-child\": \"N/A\", + \"processes\": [ + 14221, + 14223 + ], + \"put-guarded-by-semaphore\": false, + \"timeouts\": [ + 3600.0, + 0 + ], + \"writes\": { + \"all\": \"46.85%, 53.15%\", + \"avg\": \"50.00%\", + \"inqueues\": { + \"active\": 0, + \"total\": 2 + }, + \"raw\": \"12702, 14411\", + \"total\": 27113 + } + }, + \"prefetch_count\": 8, + \"rusage\": { + \"idrss\": 0, + \"inblock\": 14280, + \"isrss\": 0, + \"ixrss\": 0, + \"majflt\": 38, + \"maxrss\": 36568, + \"minflt\": 15180, + \"msgrcv\": 0, + \"msgsnd\": 0, + \"nivcsw\": 132094, + \"nsignals\": 0, + \"nswap\": 0, + \"nvcsw\": 208050, + \"oublock\": 0, + \"stime\": 26.512, + \"utime\": 393.488 + }, + \"total\": { + \"worker.tasks.do_something_awesome\": 27113 + } + } +}" + (with-mock + (mock (celery--compute-raw-celery-output) => "celery@worker02: OK\n {\n \"broker\": {\n \"alternates\": [],\n \"connect_timeout\": 4,\n \"heartbeat\": null,\n \"hostname\": \"moma\",\n \"insist\": false,\n \"login_method\": \"AMQPLAIN\",\n \"port\": 5672,\n \"ssl\": false,\n \"transport\": \"amqp\",\n \"transport_options\": {},\n \"uri_prefix\": null,\n \"userid\": \"guest\",\n \"virtual_host\": \"/\"\n },\n \"clock\": \"403897\",\n \"pid\": 14216,\n \"pool\": {\n \"max-concurrency\": 1,\n \"max-tasks-per-child\": \"N/A\",\n \"processes\": [\n 14221,\n 14223\n ],\n \"put-guarded-by-semaphore\": false,\n \"timeouts\": [\n 3600.0,\n 0\n ],\n \"writes\": {\n \"all\": \"46.85%, 53.15%\",\n \"avg\": \"50.00%\",\n \"inqueues\": {\n \"active\": 0,\n \"total\": 2\n },\n \"raw\": \"12702, 14411\",\n \"total\": 27113\n }\n },\n \"prefetch_count\": 8,\n \"rusage\": {\n \"idrss\": 0,\n \"inblock\": 14280,\n \"isrss\": 0,\n \"ixrss\": 0,\n \"majflt\": 38,\n \"maxrss\": 36568,\n \"minflt\": 15180,\n \"msgrcv\": 0,\n \"msgsnd\": 0,\n \"nivcsw\": 132094,\n \"nsignals\": 0,\n \"nswap\": 0,\n \"nvcsw\": 208050,\n \"oublock\": 0,\n \"stime\": 26.512,\n \"utime\": 393.488\n },\n \"total\": {\n \"worker.tasks.do_something_awesome\": 27113\n }\n }") + (celery--compute-json-string-stats))))) + (ert-deftest test-celery-compute-full-stats-workers () (should (equal '((worker02 (total - (swh\.worker\.tasks\.do_something_awesome . 27113)) + (worker\.tasks\.do_something_awesome . 27113)) (rusage (utime . 393.488) (stime . 26.512) @@ -59,7 +131,7 @@ [])))) (with-mock (mock (celery--compute-raw-celery-output) => - "celery@worker02: OK\n {\n \"broker\": {\n \"alternates\": [],\n \"connect_timeout\": 4,\n \"heartbeat\": null,\n \"hostname\": \"moma\",\n \"insist\": false,\n \"login_method\": \"AMQPLAIN\",\n \"port\": 5672,\n \"ssl\": false,\n \"transport\": \"amqp\",\n \"transport_options\": {},\n \"uri_prefix\": null,\n \"userid\": \"guest\",\n \"virtual_host\": \"/\"\n },\n \"clock\": \"403897\",\n \"pid\": 14216,\n \"pool\": {\n \"max-concurrency\": 1,\n \"max-tasks-per-child\": \"N/A\",\n \"processes\": [\n 14221,\n 14223\n ],\n \"put-guarded-by-semaphore\": false,\n \"timeouts\": [\n 3600.0,\n 0\n ],\n \"writes\": {\n \"all\": \"46.85%, 53.15%\",\n \"avg\": \"50.00%\",\n \"inqueues\": {\n \"active\": 0,\n \"total\": 2\n },\n \"raw\": \"12702, 14411\",\n \"total\": 27113\n }\n },\n \"prefetch_count\": 8,\n \"rusage\": {\n \"idrss\": 0,\n \"inblock\": 14280,\n \"isrss\": 0,\n \"ixrss\": 0,\n \"majflt\": 38,\n \"maxrss\": 36568,\n \"minflt\": 15180,\n \"msgrcv\": 0,\n \"msgsnd\": 0,\n \"nivcsw\": 132094,\n \"nsignals\": 0,\n \"nswap\": 0,\n \"nvcsw\": 208050,\n \"oublock\": 0,\n \"stime\": 26.512,\n \"utime\": 393.488\n },\n \"total\": {\n \"swh.worker.tasks.do_something_awesome\": 27113\n }\n }") + "celery@worker02: OK\n {\n \"broker\": {\n \"alternates\": [],\n \"connect_timeout\": 4,\n \"heartbeat\": null,\n \"hostname\": \"moma\",\n \"insist\": false,\n \"login_method\": \"AMQPLAIN\",\n \"port\": 5672,\n \"ssl\": false,\n \"transport\": \"amqp\",\n \"transport_options\": {},\n \"uri_prefix\": null,\n \"userid\": \"guest\",\n \"virtual_host\": \"/\"\n },\n \"clock\": \"403897\",\n \"pid\": 14216,\n \"pool\": {\n \"max-concurrency\": 1,\n \"max-tasks-per-child\": \"N/A\",\n \"processes\": [\n 14221,\n 14223\n ],\n \"put-guarded-by-semaphore\": false,\n \"timeouts\": [\n 3600.0,\n 0\n ],\n \"writes\": {\n \"all\": \"46.85%, 53.15%\",\n \"avg\": \"50.00%\",\n \"inqueues\": {\n \"active\": 0,\n \"total\": 2\n },\n \"raw\": \"12702, 14411\",\n \"total\": 27113\n }\n },\n \"prefetch_count\": 8,\n \"rusage\": {\n \"idrss\": 0,\n \"inblock\": 14280,\n \"isrss\": 0,\n \"ixrss\": 0,\n \"majflt\": 38,\n \"maxrss\": 36568,\n \"minflt\": 15180,\n \"msgrcv\": 0,\n \"msgsnd\": 0,\n \"nivcsw\": 132094,\n \"nsignals\": 0,\n \"nswap\": 0,\n \"nvcsw\": 208050,\n \"oublock\": 0,\n \"stime\": 26.512,\n \"utime\": 393.488\n },\n \"total\": {\n \"worker.tasks.do_something_awesome\": 27113\n }\n }") (celery-compute-full-stats-workers))))) @@ -79,7 +151,7 @@ (should-not (let ((stats '((w01 (:total 27113))))) (celery-total-tasks-per-worker stats 'w02)))) -(ert-deftest test-celery-total-tasks-per-worker () +(ert-deftest test-celery--to-org-table-row () (should (string= "| Fri Aug 7 19:02:12 2015 | 27113 | 300 | " (with-mock (mock (current-time-string) => "Fri Aug 7 19:02:12 2015") From 099a5973a7a040d24b742817f8eb21da67870bfb Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont" Date: Sat, 8 Aug 2015 22:31:23 +0200 Subject: [PATCH 11/11] Add test on main interactive commands --- celery.el | 13 ++++++++----- test/celery-test.el | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/celery.el b/celery.el index 158c590..5ad3599 100644 --- a/celery.el +++ b/celery.el @@ -204,13 +204,15 @@ So this needs to be applied in an org context to make sense." (interactive "P") (celery--with-delay-apply 'celery--stats-to-org-row refresh)) +(defalias 'celery-log-stats (-partial 'celery-log "Stats: %s")) + ;;;###autoload (defun celery-compute-stats-workers (&optional refresh) "Compute the simplified workers' stats. if REFRESH is non nil, trigger a computation. Otherwise, reuse the latest known values." (interactive "P") - (celery--with-delay-apply (-partial 'celery-log "Stats: %s") refresh)) + (celery--with-delay-apply 'celery-log-stats refresh)) (defun celery-all-tasks-consumed (stats) "Compute the total number of consumed tasks from the STATS." @@ -218,15 +220,16 @@ Otherwise, reuse the latest known values." (mapcar (-partial 'assoc-default :total)) (apply #'+))) +(defalias 'celery-log-total-tasks-consumed + (-compose (-partial 'celery-log "Number of total tasks done: %s") + 'celery-all-tasks-consumed)) + ;;;###autoload (defun celery-compute-tasks-consumed-workers (&optional refresh) "Check the current number of tasks executed by workers in celery. if REFRESH is mentioned, trigger a check, otherwise, use the latest value." (interactive "P") - (celery--with-delay-apply - (-compose (-partial 'celery-log "Number of total tasks done: %s") - 'celery-all-tasks-consumed) - refresh)) + (celery--with-delay-apply 'celery-log-total-tasks-consumed refresh)) (defvar celery-mode-map (let ((map (make-sparse-keymap))) diff --git a/test/celery-test.el b/test/celery-test.el index 386f0f6..fa3c31a 100644 --- a/test/celery-test.el +++ b/test/celery-test.el @@ -300,3 +300,33 @@ (with-mock (mock (shell-command-to-string "celery inspect stats --quiet --no-color") => :foobar) (celery--compute-raw-celery-output)))))) + +(ert-deftest test-celery-log-total-tasks-consumed () + (should (string= "Celery - Number of total tasks done: 6000" + (celery-log-total-tasks-consumed '((w01 (:total . 1000) (:processes . 1)) + (w02 (:total . 2000) (:processes . 2)) + (w03 (:total . 3000) (:processes . 3))))))) + +(ert-deftest test-celery-log-stats () + (should (string= "Celery - Stats: ((w01 (:total . 1000) (:processes . 1)) (w02 (:total . 2000) (:processes . 2)) (w03 (:total . 3000) (:processes . 3)))" + (celery-log-stats '((w01 (:total . 1000) (:processes . 1)) + (w02 (:total . 2000) (:processes . 2)) + (w03 (:total . 3000) (:processes . 3))))))) + +(ert-deftest test-celery-stats-to-org-row () + (should (eq :res + (with-mock + (mock (celery--with-delay-apply 'celery--stats-to-org-row :refresh) => :res) + (celery-stats-to-org-row :refresh))))) + +(ert-deftest test-celery-compute-tasks-consumed-workers () + (should (eq :res + (with-mock + (mock (celery--with-delay-apply 'celery-log-total-tasks-consumed :refresh) => :res) + (celery-compute-tasks-consumed-workers :refresh))))) + +(ert-deftest test-celery-compute-stats-workers () + (should (eq :res + (with-mock + (mock (celery--with-delay-apply 'celery-log-stats :refresh) => :res) + (celery-compute-stats-workers :refresh)))))