[cli] more detailed worker stats reporting (list messages)

parent 763d4d35
Pipeline #6888 failed with stages
in 19 minutes and 11 seconds
......@@ -70,9 +70,18 @@ workerCLI (CLIW_stats (WorkerStatsArgs { .. })) = do
let ws = env ^. hasConfig . gc_worker
mapM_ (\wd -> do
state' <- initWorkerState env wd
let b = W.broker state'
let q = W.queueName state'
qs <- BT.getQueueSize (W.broker state') q
qs <- BT.getQueueSize b q
msgIds <- BT.listPendingMessageIds b q
putStrLn ("Queue: " <> show q <> ", size: " <> show qs :: Text)
putStrLn (" Messages: " :: Text)
mapM_ (\msgId -> do
mm <- BT.getMessageById b q msgId
case mm of
Nothing -> putStrLn (" - " <> show msgId <> " :: NOTHING!" :: Text)
Just m -> putStrLn (" - " <> show m :: Text)
) msgIds
) (_wsDefinitions ws)
......@@ -82,10 +91,10 @@ workerCmd = command "worker" (info (helper <*> (fmap CLISub $ fmap CCMD_worker w
workerParser :: Parser CLIWorker
workerParser = hsubparser (
(command "run" (info (helper <*> worker_p)
(progDesc "Run a single worker"))) <>
(command "stats" (info (helper <*> stats_p)
(progDesc "Print queue stats")))
command "run" (info (helper <*> worker_p)
(progDesc "Run a single worker")) <>
command "stats" (info (helper <*> stats_p)
(progDesc "Print queue stats"))
)
worker_p :: Parser CLIWorker
......
......@@ -191,12 +191,12 @@ source-repository-package
source-repository-package
type: git
location: https://gitlab.iscpif.fr/gargantext/haskell-pgmq
tag: 0591a643d8ba1776af4fac56c1e4ff5fc3e98bb3
tag: 1dd92f0aa8e9f8096064e5656c336e562680f4e3
source-repository-package
type: git
location: https://gitlab.iscpif.fr/gargantext/haskell-bee
tag: 00a4113992545d1e0a78b9f73a69ec527e79bd1b
tag: ec2c3f345049f7cd0b8f4e39edf11c7e437d0cf6
source-repository-package
type: git
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment