I have a bot that a I want to keep running indefinitely and I want to control it from a webapp. I'd like to use Flask to get command requests from the UI and delegate configuration to the Bot.
I've heard and read about celery and message queuing with workers, which seems to be to way to do it, but I can't figure out how.
First, all the Celery tutorials mention long tasks but my Bot activity never ends. It shares Flask instance lifetime, meaning that the Bot borns when the Flask instance is launched and dies when Flask instance is switched off. Tutorials mention workers but I only need a single Bot, so a single worker?
I also thought about making a new thread inside a Flask instance but I wonder if multiple connections trowing commands at the same time won't break it.
Is there any way I can control this never-ending task from Flask by pushing configuration from it safely and asynchronously? Do I need a multiple components architecture or can I do all this stuff from a simple Flask instance?