Web2py Scheduler 在开始从不同 UI 启动的新任务之前等待任务完成

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

我有一个小型 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

现在这是一个网络应用程序,长 运行 进程从 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)

您可能想要启动多个 worker。例如,启动四个工人:

-K myapp,myapp,myapp,myapp