Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How use Python scalene for memory profiling inside a celery task

Tags:

python

scalene

I need to debug a celery task for its memory and CPU using scalene. https://github.com/emeryberger/scalene

When I read the docs, it only states to debug using console i.e. python -m scalene test/testme.py or scalene test/testme.py. I want to know if it is possible to use some kind of context manager inside my program for profiling which can output in a file? Only a few lines of code look suspicious to me so I was wonder if that an option.

Thanks.

like image 933
A.J. Avatar asked Jun 17 '26 20:06

A.J.


1 Answers

Scalene author here. It is not yet an option; doing this with memory profiling seems tricky since it relies on loading a special runtime library. For CPU profiling only, it’s possible, but honestly I think it’s worth just giving it a try at the command line!

like image 126
EmeryBerger Avatar answered Jun 20 '26 09:06

EmeryBerger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!