diff options
author | Frederick Muriuki Muriithi | 2023-05-22 08:32:12 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-05-22 08:32:12 +0300 |
commit | 0c7106202cd0cb549e731a43a64a95116756daf6 (patch) | |
tree | d54a4d92a0564a8dde019fd06235dfab7e1bb7e5 | |
parent | f76d469543691c992242eb991e3c6ef2a5c5803b (diff) | |
download | genenetwork2-0c7106202cd0cb549e731a43a64a95116756daf6.tar.gz |
Enable running application under pdb.
Add an option to help with running the application under pdb, and add
some documentation to help other developers figure it out.
-rw-r--r-- | README.md | 22 | ||||
-rwxr-xr-x | bin/genenetwork2 | 12 |
2 files changed, 34 insertions, 0 deletions
@@ -78,6 +78,28 @@ startup script [./bin/genenetwork2](https://github.com/genenetwork/genenetwork2/ Also mariadb and redis need to be running, see [INSTALL](./doc/README.org). +## Debugging + +To run the application under the pdb debugger, you can add the `--with-pdb` +option when launching the application, for example: + +```sh +env GN2_PROFILE=~/opt/gn-latest SERVER_PORT=5300 \ + GENENETWORK_FILES=~/data/gn2_data/ \ + GN_PROXY_URL="http://localhost:8080"\ + GN3_LOCAL_URL="http://localhost:8081"\ + SPARQL_ENDPOINT=http://localhost:8892/sparql\ + ./bin/genenetwork2 ./etc/default_settings.py --with-pdb +``` + +**NOTE**: This should only ever be run in development. +**NOTE 2**: You will probably need to tell pdb to continue at least once before +the system begins serving the pages. + +Now, you can add the `breakpoint()` call wherever you need to debug and the +terminal where you started the application with `--with-pdb` will allow you to +issue commands to pdb to debug your application. + ## Development It may be useful to pull in the GN3 python modules locally. For this diff --git a/bin/genenetwork2 b/bin/genenetwork2 index 57fd8588..d0aa5d71 100755 --- a/bin/genenetwork2 +++ b/bin/genenetwork2 @@ -221,6 +221,18 @@ fi # Overrides for packages that are not yet public (currently r-auwerx) # export R_LIBS_SITE=$R_LIBS_SITE:$HOME/.Rlibs/das1i1pm54dj6lbdcsw5w0sdwhccyj1a-r-3.3.2/lib/R/lib + + +if [ "$1" = "--with-pdb" ] ; then + cd "${GN2_BASE_DIR}/wqflask" + cmd=$2 + echo PYTHONPATH="${PYTHONPATH}" + shift ; shift + echo "RUNNING COMMAND python3 -m runserver.py" + python3 -m pdb runserver.py + exit $? +fi + # Start the flask server running GN2 cd "${GN2_BASE_DIR}/wqflask" echo "Starting with $settings" |