Debugging¶
Since the uwsgi uses the spooler processes, debugging the task execution in these process requires a hack through remote debugging.
pip install pydevd-pycharm==191.6605.12 (versions must be upgraded, see preferences/about)
open a shell in the environment and launch uwsgi with a set of arguments:
uwsgi --check-static=./resources --http=:8000 --master \ --module=wsgi --callable=application \ --pythonpath=/Users/gu/Workspace/opdm-service \ --processes=2 --spooler=./resources/uwsgi-spooler --spooler-processes=1
define a python remote debug configuration on pycharm, using localhost:4444 as host:port, and following the instructions on how to install pydevd
add this snippet to code
import pydevd pydevd.settrace('localhost', port=4444, stdoutToServer=True, stderrToServer=True)
use wsgi.py to debug the request/response processes and taskmanager/models.py or taskmanager/tasks.py, to debug the command execution
add breakpoints
launch the uwsgi command in terminal
launch the debugger in pycharm
navigate, create and launch the task
debug!
When no debugger is activated, this can be used to test the uwsgi-spooler in a local development environment. Just remove the code snippets and launch the uwsgi command from the terminal.
You’ll be able to manage tasks and execute the commands using the uwsgi spooler processes.