Web Interface for the NPSAT tool
See Confluence for internal notes on how we deployed this
This backend code has a slightly convoluted process for handling runs, but it makes sense based on the other design constraints. The main Django code accepts parameters for a new run over the ModelRun API interface. It logs these parameters to the database for a ModelRun.
A django management command process_runs
must be running in the background - it is set up this
way since it needs its own event loop to be able to manage a queue and send commands to the Mantis
server and load results. It will pull new runs from the database and send them to Mantis,
then load results in the database when they come back. ModelRun.running and ModelRun.complete
will be set appropriately to reflect the status of a ModelRun. An API endpoint can provide
this status so the frontend can query whether results are available, then query for results
when they are ready (or maybe if it queries for status and status is "complete" it gets the
results back too to save additional querying)
One must follow the following steps in order to test run the server in local development environment
- Run Mantis Server: Change directory to
/Mantis/Data
, then use MantisServer executable to runmantisConfig.ini
with the following command:/Mantis/CPP/MantisServer/MantisServer/MantisServer.exe -c mantisConfig.ini
- In a seperate terminal, change directory to
npsat_web_backend
, run commandPython3 manage.py runserver 8010
. When the server started, login Django administration in your local browser with link "localhost:8010/admin". Find MantisServer Object and manually set its port to '1234', and set its status to 'online'. Once the above steps are done, restart the server (important step not to be skipped). - In a seperate terminal, change directory to
npsat_web_backend
, run commandPython3 manage.py process_runs
to start the processor - In a seperate terminal, change directory to
npsat_web_frontend_v2
and run commandnpm start
. DEBUG: If the complilation fails due to JavaScript Heap Memory Leak, set the memory parameter to a larger number (for example 4GB) by running commandexport NODE_OPTIONS="--max-old-space-size=4096"
beforenpm start
- Super User: Super user allows you to test the server with the highest administrative privileges. To set super user, run command in
npsat_web_backend
Python3 manage.py createsuperuser
, then set username and password by following the prompts. - Load Initial Data: Initial data need to be loaded before server is started. In
npsat_web_backend
, run commandPython3 manage.py load_initial_data
. If the initial data is loaded repeatedly, run commandPython3 manage.py flush
first to clear up the old data in the database.