【问题标题】:Adding extra celery configs to Airflow向 Airflow 添加额外的 celery 配置
【发布时间】:2017-12-12 06:50:44
【问题描述】:

有人知道我可以在哪里为气流芹菜执行器添加额外的芹菜配置吗?例如我想要http://docs.celeryproject.org/en/latest/userguide/configuration.html#worker-pool-restarts 这个属性,但是我如何允许额外的芹菜属性..

【问题讨论】:

    标签: celery airflow


    【解决方案1】:

    使用刚刚发布的 Airflow 1.9.0,现在可以进行配置了。

    airflow.cfg 中有这一行:

    # Import path for celery configuration options
    celery_config_options = airflow.config_templates.default_celery.DEFAULT_CELERY_CONFIG
    

    从导入路径指向一个python文件。当前默认版本可以是https://github.com/apache/incubator-airflow/blob/1.9.0/airflow/config_templates/default_celery.py

    如果您需要无法通过该文件进行调整的设置,请创建一个新模块,例如“my_celery_config.py”:

    CELERY_CONFIG = {
        # ....
    }
    

    并将其放在您的 AIRFLOW_HOME 目录中(即在 dags/ 文件夹旁边),然后在配置中设置 celery_config_options = my_celery_config.CELERY_CONFIG

    【讨论】:

    • 扩展您的答案:from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG CELERY_CONFIG = dict(DEFAULT_CELERY_CONFIG, **{key1: value1, ...}) 将为您提供所有常规默认值,并覆盖您的值
    • 这在最新版本的气流中对我不起作用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-22
    • 2016-05-20
    相关资源
    最近更新 更多