芹菜节拍:任务在celery.conf_schedule中,但不会在节拍工作日志中运行或出现

时间:2017-07-27 15:54:21

标签: python rabbitmq celery

我正在运行芹菜v4.0.2,rabbitmq 3.6.10和烧瓶。

以下代码构建了我的Celery对象。

def make_celery(app):
    celery = Celery(app.import_name, backend='rpc://', broker='amqp://', include=['jobs'])
    celery.conf.update(app.config)
    TaskBase = celery.Task

    class ContextTask(TaskBase):
        abstract = True

        def __call__(self, *args, **kwargs):
            with app.app_context():
                return TaskBase.__call__(self, *args, **kwargs)

    celery.Task = ContextTask
    return celery


logger.init_logger(console=True, log_dir=False, verbose=False)

logger.info('Starting Application')
app = Flask(__name__, instance_relative_config=True)
celery = make_celery(app)

然后我使用以下内容向节拍时间表添加任务,

celery.add_periodic_task(10.0, APP.jobs.ex.s())
print celery.conf.beat_schedule

>> {'APP.jobs.ex()': {u'kwargs': {}, u'task': u'APP.jobs.ex', u'options': {}, u'args': (), u'schedule': 10.0}}

我在这里经营一名工人,这适用于添加正常任务,

celery -A APP.celery worker -l info

我在这里运行节拍调度程序,

celery -A APP.celery beat -l info

>> celery beat v4.0.2 (latentcall) is starting.
__    -    ... __   -        _
LocalTime -> 2017-07-27 16:31:16
Configuration ->
    . broker -> amqp://guest:**@localhost:5672//
    . loader -> celery.loaders.app.AppLoader
    . scheduler -> celery.beat.PersistentScheduler
    . db -> celerybeat-schedule
    . logfile -> [stderr]@%INFO
    . maxinterval -> 5.00 minutes (300s)
[2017-07-27 16:31:16,320: INFO/MainProcess] beat: Starting...

但是,从这一点来说没有任何反应。有什么想法吗?

0 个答案:

没有答案