couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject Re: Long running task status monitoring
Date Fri, 23 Jan 2009 04:42:06 GMT
On Thu, Jan 22, 2009 at 8:18 PM, Damien Katz <> wrote:
> I just checked in code to allow the checking of the status of long running
> tasks, like view indexes and compaction.
> During a long view build or compaction, if you want to see the status of
> what's happening, simply GET _active_tasks and you'll get back a list of
> JSON objects describing the currently running tasks.
> Example results while 2 tasks are running:
> [{"type":"Database Compaction","task":"speed","status":"Copied 10001 of
> 39001 changes (25%)","pid":"<0.78.0>"},
> {"type":"View Group Indexer","task":"speed _design/test","status":"Processed
> 0 of 39001 changes (0%)","pid":"<0.91.0>"}]
> We should probably add task tracking code for replication as well.

This is the dev list, so I'll add some dev notes based on my reading
of the source. Damien, please correct me if I get this wrong.

A process can register itself with the couch_task_status server, by calling

couch_task_status:add_task(Type, TaskName, StatusText)

then it can update the status as it progresses by calling


It has the option to throttle its own updates (eg updates coming too
soon after previous updates are ignored) by calling

A task is removed from the active task list when the process that
registered is dies. Also, each process can only have a single active

Adding this to replication should be straightforward, if anyone wants
to have a go at it.


Chris Anderson

View raw message