如何在Celery中使用气流 [英] How to use airflow with Celery

查看:49
本文介绍了如何在Celery中使用气流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对气流和芹菜不熟悉,现在我已经完成了绘画的工作,但是我想在同一子网中的两台计算机上运行任务,我想知道如何修改airflow.cfg。一些例子可能会更好。

I'm new to airflow and celery, and I have finished drawing dag by now, but I want to run task in two computers which are in the same subnet, I want to know how to modify the airflow.cfg. Some examples could be better. Thanks to any answers orz.

推荐答案

气流文档很好地介绍了这一点:

The Airflow documentation covers this quite nicely:

首先,您需要一个芹菜后端。例如,这可以是Redis或RabbitMQ。然后,将airflow.cfg中的executor参数设置为 CeleryExecutor

First, you will need a celery backend. This can be for example Redis or RabbitMQ. Then, the executor parameter in your airflow.cfg should be set to CeleryExecutor.

然后,在airflow.cfg的芹菜部分中,设置 broker_url 指向您的celery后端(例如redis:// your_redis_host:your_redis_port / 1)。
celery_result_backend 指向sql数据库(您可以使用与主气流数据库相同的数据库)。

Then, in the celery section of the airflow.cfg, set the broker_url to point to your celery backend (e.g. redis://your_redis_host:your_redis_port/1). Point celery_result_backend to a sql database (you can use the same as your main airflow db).

然后,在工作人员机器上简单地启动气流工作人员,您的工作应在两台机器上开始。

Then, on your worker machines simply kick off airflow worker and your jobs should start on the two machines.

这篇关于如何在Celery中使用气流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆