Skip to content

Rewrite of the RCGUI backend

Edward Karl Galantay requested to merge rcgui/refactor into master

Changes

The idea is to have a more modular RCGUI, with more robust authentication and better error handling.

  • Multiple run can happen at the same time, but can be restricted to only one run at a time, depending on the value provided in the server configuration file
  • The app is separated into several folder, each responsible of a part of the application.
  • utils/folder contains code that could be useful elsewhere and can be used without the full RCGUI.
  • "Bots" will have to be "accepted" by providing a token, to restrict and keep track of what can communicate with the server.
  • HTTP responses have correct codes.
  • Each running configuration is handled by a DaqHandler. The DaqHandler class can be inherited, allowing custom daqhandlers to be implemented.
  • The DaqHandlers are managed by the DaqHandler manager (DhManager). This class allows to check the global status of the app and restrict the number of running configuration if "single mode" is enabled.

Automatic Restart

By specifying regular expressions, it is possible to keep track of some modules, and if they crash or are in error state, stop the current run, shutdown and start a new one. If an action (STOP, SHUTDOWN, INITIALISE, START) fails, the system will force shutdown and try again, until a manual command is executed or the action succeeds.

Logging System

For better error handling, a new logging system has been implemented. The logger "daqControl" is available for all modules running in the same python session as the daqControl module.

with logger = logging.getLogger("daqControl")

The logger contains three different handlers : file, console and socketio.

  • The file allows the logs to be stored in a `.jsonl` file (same as `.json`, but each line is a json object), allowing to keep formatting for later use (display it on the rcgui for example).
  • The console is responsible for printing the logs in `stdout`, with the flask logger (wsgi)
  • The socketio handler will send the log informations to the rcgui interface, so that they are displayed in real time.

The logger can be configured at the following location : daqControl/utils/custo_logging.py

Edited by Edward Karl Galantay

Merge request reports