Skip to content

Standard flask app

Wout De Nolf requested to merge proper_flask_app into main

Changes

  • Standard flask API practices (separate routes, config and app creation)
  • console script for run_ppf_json called bes-run-workflow (this part will require updating mxnice, the python environment needs to be activated when starting the BES server. Edit: it seems like the current bes_start bash script already does this)
  • Test flask server in CI
  • No hard-coding of EDNA_HOME and the BESDB mongo url (this part will require updating mxnice by adding BESDB_HOST=besdb1.esrf.fr)

Examples

Start the development server

flask --app bes.bin.ppf_server run [--host 127.0.0.1] [--port 5000] [--debug]

Start the production server

export BESDB_HOST=...
export BESDB_PORT=...
gunicorn bes.bin.ppf_server:app [--host 127.0.0.1] [--port 8000] [--log-level DEBUG]

Run a workflow

bes-run-workflow BesTestExecution --inData='{"callBackHost":"127.0.0.1", "callBackPort":8000}'

Tested in production

Test server http://scisoft10.esrf.fr:39002/ deployed with this configuration. BesTestExecution runs and visible in besgui

export JSON_DATA='{ "callBackHost": "127.0.0.1", "callBackPort": "8080" }'
curl -v -X POST "http://scisoft10.esrf.fr:39002/RUN/BesTestExecution" -H "Content-Type: application/json" -d "$JSON_DATA"
Edited by Wout De Nolf

Merge request reports