小编Ala*_*tti的帖子

芹菜运行工人与-Ofair从python

我有一个与rabbitmq的芹菜设置.问题是芹菜在运行长任务时将任务移动到保留状态,并且在长时间运行的任务完成之前不执行它们.

我想在不使用路由的情况下实现这一点,并启用"-Ofair"标志来完成工作.Prefork池预取设置

如何在celery python中启用标志?谢谢

我正在使用芹菜3.1.19

$ celery report
software -> celery:3.1.19 (Cipater) kombu:3.0.32 py:3.4.3
            billiard:3.3.0.22 py-amqp:1.4.8
platform -> system:Linux arch:64bit, ELF imp:CPython
loader   -> celery.loaders.default.Loader
settings -> transport:amqp results:disabled
Run Code Online (Sandbox Code Playgroud)

我使用Celery如下,并发性设置为4:

app = celery.Celery()
app.conf.update(
    BROKER_URL=broker,
    CELERY_RESULT_BACKEND=backend,
    CELERY_TASK_SERIALIZER='json',
    CELERY_IMPORTS=imports or [],
    CELERYD_CONCURRENCY=concurrency,
    CELERYD_HIJACK_ROOT_LOGGER=False
)
Run Code Online (Sandbox Code Playgroud)

以下是我开始工作的方式:

worker = app.Worker(
    hostname=hostname,
    queues=[hostname]
)
worker.start()
Run Code Online (Sandbox Code Playgroud)

python concurrency celery

4
推荐指数
1
解决办法
2348
查看次数

标签 统计

celery ×1

concurrency ×1

python ×1