Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 设置小时后芹菜节拍不发送crontab任务_Python_Celery_Celery Task - Fatal编程技术网

Python 设置小时后芹菜节拍不发送crontab任务

Python 设置小时后芹菜节拍不发送crontab任务,python,celery,celery-task,Python,Celery,Celery Task,我使用的是芹菜4.1,除了在crontab任务中设置小时之外,我所有的定期任务都正常工作。我认为这与时区设置有关,但我似乎不知道问题出在哪里 仪表板/芹菜.py from __future__ import absolute_import, unicode_literals from celery import Celery app = Celery('dashboard', broker='redis://', backend='redis://local

我使用的是芹菜4.1,除了在crontab任务中设置小时之外,我所有的定期任务都正常工作。我认为这与时区设置有关,但我似乎不知道问题出在哪里

仪表板/芹菜.py

from __future__ import absolute_import, unicode_literals
from celery import Celery

app = Celery('dashboard',
         broker='redis://',
         backend='redis://localhost',
         include=['dashboard.tasks'])

app.conf.update(
    result_expires=3600,
    enable_utc = False,
    timezone = 'America/New_York'
)


if __name__ == '__main__':
    app.start()
这项工作:

@app.task
@periodic_task(run_every=(crontab()))
def shutdown_vms():
    inst = C2CManage(['stop','kube'])
    inst.run()
    return
@app.task
@periodic_task(run_every=(crontab(minute=30,hour='*')))
def shutdown_vms():
    inst = C2CManage(['stop','kube'])
    inst.run()
    return
这项工作:

@app.task
@periodic_task(run_every=(crontab()))
def shutdown_vms():
    inst = C2CManage(['stop','kube'])
    inst.run()
    return
@app.task
@periodic_task(run_every=(crontab(minute=30,hour='*')))
def shutdown_vms():
    inst = C2CManage(['stop','kube'])
    inst.run()
    return
这不起作用:

@app.task
@periodic_task(run_every=(crontab(minute=30,hour=6)))
def shutdown_vms():
    inst = C2CManage(['stop','kube'])
    inst.run()
    return
Beat很好地完成了任务:

<ScheduleEntry: dashboard.tasks.shutdown_vms dashboard.tasks.shutdown_vms() <crontab: 30 6 * * * (m/h/d/dM/MY)>

我主要是独立运行它们,或者使用multi。

看起来是这个bug造成的

还有一些其他原因表明,当不使用UTC时,调度计算不正确


将芹菜切换为使用UTC作为时区并启用UTC,效果良好。

我通过使用芹菜==4.0.1解决了此问题。

也为我解决了此问题。。。这真的让我很恼火芹菜的开发团队有世界上所有的时间来添加后端种类12,异国情调功能xyz,现在将整个设置命名约定更改为“小写”,好像这真的能帮助任何人,当他们甚至不能保持芹菜稳定用于其主要目的时——按时运行任务。对我来说,我从芹菜4.1开始,使用UTC是一个很好的解决方案。不管怎样,只要有助于你让它工作起来,那就是你要走的路。我同意你关于完成工作的“优先级”的看法,但当人们在业余时间支持事情时,很难抱怨……当我使用芹菜4.1并设置时区UTC时,时间不正确UTC时间,你是如何做到的?很抱歉回复太晚:
app.conf.update(结果\u expires=3600,启用\u utc=true,时区='utc')