Python Forum

Full Version: Web Framework background tasks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there

So this is my first thread Smile

I'm currently making a interface for managing our building. The scope of this project is getting a smarter building. My code is basically ready but there's always room for improvement. Never be satisfied Big Grin

These are the tasks i'm currently running:
  • Getting temperature and setpoint data from about 50 rooms [every 5 minutes] ==> database
  • Decide whether the building needs to be cooled or heated based on my own algorithm (looks more complicated then it is) and change a webrelay based on this decision [every 15 minutes]
  • Getting flowmeter data because the building gets it's heat throug series of heatpumps with ground water [every 1 minute]
  • Sending a monthly report for deciding whether a maintenance is nescessary on the ground water pumps [every 1st of the month]
  • In case of errors or warnings on the flowmeter ==> email [every 5 minutes]

I'm not really satisfied of the project right now because I have 2 running back-ends. I have 1 back-end in NodeJS for communicating between my UI (written in Angular5) and DB which serves for getting data and communicating to the webrelais (CORS and security), and I have 1 for saving data to the DB in Python.

The problem is that when I decide I want to remotely override the python webrelais decision with the UI, i really can't do it without using the database as kind of "broker". I don't think this is the best way to do this.

So what I'm basically searching for is a python framework or solution, which allows me to run recurring background tasks (multiple at once) and serving an API at the same time in 1 script.

If my question wasn't clear or you need more info just ask me Big Grin

I'm sorry if my English is kinda hairy

Thanks in advance!