如何在Celery中使用气流

编程入门 行业动态 更新时间:2024-10-22 09:42:07
本文介绍了如何在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中使用气流

本文发布于:2023-11-23 19:48:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622674.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:气流   如何在   Celery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!