[TIP] Running Coverage.py with Production load and getting the report every hour

Ned Batchelder ned at nedbatchelder.com
Mon Jan 23 03:49:45 PST 2017

The amount of memory is roughly proportional to the number of executed
lines.  So you should quickly get to a plateau of memory usage.

There is no configuration option in coverage to make it dump the data
file occasionally, but you might be able to use the coverage API to do
what you want. I'd be interested to hear the outcome of that.


On 1/23/17 2:54 AM, Ankit Chopra wrote:
> Hi Ned,
> Thanks for replying. Its a Python App running on django. Yes I can
> figure out a way to gracefully stop it and start it again as we are
> running bunch of the instances at a time. this is the option with us
> but I was looking that if there is any configuration in coverage.py
> with which I can expect the dump intermediately. 
> Another thing which if you can make me understand is how coverage.py
> keeps data in memory.  Let say if i let it runs for a month, does it
> going to increase the memory usage with time or it loads all the
> source code and maintain a dictionary with flag 0 or 1 for every
> line.  If its like that then it will not use the more memory with
> time, it will just mark the 1 for the lines executed.
> Thanks,
> Ankit Chopra
> On Mon, Jan 23, 2017 at 3:55 AM, Ned Batchelder <ned at nedbatchelder.com
> <mailto:ned at nedbatchelder.com>> wrote:
>     On 1/22/17 4:04 AM, Ankit Chopra wrote:
>>     Hi All, 
>>     We want to run coverage.py in our production application. We want
>>     to discover the obsolete code and see the report with actual
>>     production load. 
>>     I have played with coverage.py tool and have seen that it creates
>>     the report after execution/termination and till that time it
>>     keeps everything in memory.  
>>     Is there a way I can configure it to dump the report at regular
>>     interval like every hour or daily without stopping my
>>     application. and Later on I can merge and create a consolidated
>>     report. 
>     What kind of application is it, why does it run so long, and is
>     there a natural unit of work that you could take advantage of? For
>     example, if it's a web application, the simplest thing would be to
>     measure coverage on a worker process, and start and stop workers
>     on the frequency you want.
>     --Ned.
>     _______________________________________________
>     testing-in-python mailing list
>     testing-in-python at lists.idyll.org
>     <mailto:testing-in-python at lists.idyll.org>
>     http://lists.idyll.org/listinfo/testing-in-python
>     <http://lists.idyll.org/listinfo/testing-in-python>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20170123/52087e2a/attachment.html>

More information about the testing-in-python mailing list