我有一个小型Web应用程序,它处理后台任务。该任务需要5分钟才能完成。所以我使用了调度程序。
我已将调度程序配置为ubuntu机器中的服务。
[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
现在这是一个webapp,从UI启动长时间运行的进程。现在,当从多个浏览器启动此过程时,调度程序似乎等待按顺序完成任务,以便触发它们。
能否请您指明方向,以便调度程序在看到任务时立即获取作业执行。
截至目前,我正在以这种方式启动任务:
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)
您可能想要启动多个工作人员。例如,要启动四个工人:
-K myapp,myapp,myapp,myapp