schedulerweb2pyweb2py-modules

Web2py Scheduler Waiting for a task to complete before starting a new task launched from different UI


I have a small web application and it process background task. The task takes 5 minutes to complete. So i have used scheduler.

I have configured scheduler as service in a ubuntu machine.

[Unit]
Description=Web2Py scheduler service

[Service]
ExecStart=/usr/bin/python /home/www-data/web2py/web2py.py -K myapp
Type=simple

[Install]
WantedBy=multi-user.target

Now this is a webapp and the long running process is launched from UI. Now when this process is launched from multiple browser, it seems the scheduler waits for the tasks sequentially to be completed in order they were triggered.

Can you please suggest me the way, so that scheduler immediately picks up the job execution the moment it sees the task.

As of now I am initiating the task this way:

def initiate_fileprocess(proc_row_id):
    #code to parse and return result

scheduler.queue_task(initiate_fileprocess, pvars=dict(proc_row_id=proc_row_id), timeout=3600)

Solution

  • You probably want to start multiple workers. For example, to start four workers:

    -K myapp,myapp,myapp,myapp