Pregunta

I'm integrating the uWSGI spooler into my system. The uWSGI spooler is a task queue that works by writing the task files to a specific directory and then background processes take those files one by one, process them and finally delete them. I want to be able to save the task file entry into a database. So everytime a task file is written to the specified directory, I want to be able to put an entry into the DB as well and as soon as the task is processed, I want to mark that process as complete in the DB. How should I go about it?

¿Fue útil?

Solución

Write the db record at the start of the spooler function (in the function itself), update it before the function returns. (eventually you can write a handy decorator for it)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top