This developer guide is meant for software developers who would like to understand REANA source code and contribute to it.
REANA cluster is composed of several micro-services with multiple independent
source code repositories. reana
is a helper development script that
facilitates working with multiple repositories for local development and
integration testing purposes.
.. click:: reana.cli:cli :prog: reana
You can use --help
option to see the detailed help for each command.
In order to debug a REANA component, you first have to install REANA cluster in the development mode (see reana-cluster documentation). Once you have done this, you have to build the image of the component you are working on in development mode and we restart the corresponding pod:
$ cd src/reana-server
$ # if we are not connected to the minikube docker daemon we should do it
$ eval "$(minikube docker-env)"
$ docker build . --build-arg DEBUG=true -t reanahub/reana-server:latest
$ kubectl delete pod --selector=app="server"
Let us now introduce wdb breakpoint as the first instruction of the first instruction of the get_analyses() function located in reana_server/rest/analyses.py:
We can check that the code has been in fact updated and make a request to the component:
$ kubectl logs --selector=app="server"
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 310-304-952
172.17.0.1 - - [15/Feb/2018 12:43:49] "GET /api/ping HTTP/1.1" 200 -
* Detected change in '/code/reana_server/rest/analyses.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 310-304-952
$ curl "192.168.99.100:30659/api/analyses?organization=default&user=00000000-0000-0000-0000-000000000000"
After doing that we can go to the wdb dashboard (you can get wdb
address
using reana-cluster get wdb).
And finally select the debugging session.
Limitations
It is not possible to get live code updates in workflow engine components since celery option --autoreload doesn't work and it is deprecated. To debug celery right now:
- Set breakpoint:
import wdb; wdb.set_trace()
- Kill the workflow engine container:
kubectl delete pod cwl-default-worker-2461563162-r4hgg