【问题标题】:Web2py Scheduler Waiting for a task to complete before starting a new task launched from different UIWeb2py 调度程序在开始从不同 UI 启动的新任务之前等待任务完成
【发布时间】:2019-02-16 15:21:17
【问题描述】:

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

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

【问题讨论】:

    标签: scheduler web2py web2py-modules


    【解决方案1】:

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

    -K myapp,myapp,myapp,myapp
    

    【讨论】:

    • 你能解释一下这里的 myapp 是什么吗?
    猜你喜欢
    • 1970-01-01
    • 2012-01-17
    • 1970-01-01
    • 1970-01-01
    • 2020-03-15
    • 2015-10-25
    • 2021-09-27
    • 2015-04-24
    • 1970-01-01
    相关资源
    最近更新 更多