通过气流将任务分配给特定的机器 [英] Assigning tasks to specific machines with airflow

查看:82
本文介绍了通过气流将任务分配给特定的机器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Airflow的新手。

I'm new to Airflow.

我有一个DAG,其中包含应在特定计算机上运行的任务(在我的情况下为EMC集群)。我该如何告诉气流在哪里运行特定任务,以便每次运行时都只能在那台机器上运行?

I have a DAG which contains a task that should run on a specific machine (EMR cluster in my case). How can I tell airflow where to run specific tasks so that every time it will run it will do so on that machine only?

推荐答案

使用队列名称在该计算机上运行您的工作程序。在气流cli中,您可以执行以下操作:

Run your worker on that machine with a queue name. In the airflow cli you could do something like:

airflow worker -q my_queue

然后定义该任务以使用该队列:

Then define that task to use that queue:

task = PythonOperator(
    task_id='task',
    python_callable=my_callable,
    queue='my_queue',
    dag=dag)

这篇关于通过气流将任务分配给特定的机器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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