Hi group,

I am going to implement a homemade task queue as a background process for 
updating database, and I have some questions as below:

1. does a background process updating a database interfere with controller 
functions that operate on the same database? For example, if I have a task 
queue filled with a stream of database updates, will this background 
process block any other database actions performed through controller 
functions in web2py? Moreover, Is it recommended to run several background 
processes which will all read/write from/to the database?

2. given the mail queue example in the manual, it seems that a background 
process is usually a forever loop that processes things upon their 
'arrivals'. In the mail example, this is done by checking records in the db 
so the queue is effectively a table of records. I wonder if I can simply 
replace this 'table queue' with a 'message queue' using RabbitMQ and Pika 
library, or there is more complication involved for such implementation? In 
addition, in web2py how should we detect and restart a background process 
when it dies unexpectedly.

3. according to the manual, a background process is run as a separate 
python module:

python web2py.py -S app -M -N -R applications/app/private/task_queue.py

Does the argument '-S app' have to match the name of the web2py application 
this module is running for? Second, in a production environment, what is 
the proper way of initiating a background process? In other words, is there 
a better way than manually invoking this from command line as we deploy the 
application?

Any suggestion and comment is welcome. Thanks!

Reply via email to