use `pdb` for debugging

Debugging after ssh into uat

Prerequisite

Go into the ipython shell e.g. sudo docker exec -it oneview-django poetry run python manage.py shell

In [1]: from oneview.graphql.api.charge import one_fee_calculator

In [2]: review_id = "73a07db5-7214-4ead-a9b8-4906e1727a8c"

In [3]: import pdb
        pdb.runcall(one_fee_calculator, review_id)
[1] > /app/backend/oneview/graphql/api/charge.py(248)one_fee_calculator()
-> review = Review.objects.get(id=review_id)

If you do the above, you will be dropped into the pdb debugging shell.

Note: please be careful about possible side effects if the functions called especially if you are doing this in uat or even prod environment.

pdb

pdb is an interactive source code debugger for Python programs.

pdb is very powerful, though you need to get familiar with the commands

You can find the pdb commands doc here

Most useful commands I find are