【发布时间】:2019-02-22 15:20:43
【问题描述】:
我正在阅读 Apache Airflow 教程 https://github.com/hgrif/airflow-tutorial 并遇到了定义任务依赖项的这一部分。
with DAG('airflow_tutorial_v01',
default_args=default_args,
schedule_interval='0 * * * *',
) as dag:
print_hello = BashOperator(task_id='print_hello',
bash_command='echo "hello"')
sleep = BashOperator(task_id='sleep',
bash_command='sleep 5')
print_world = PythonOperator(task_id='print_world',
python_callable=print_world)
print_hello >> sleep >> print_world
让我感到困惑的是
print_hello >> sleep >> print_world
>> 在 Python 中是什么意思?我知道按位运算符,但不能与这里的代码相关。
【问题讨论】:
-
是的,
>>默认情况下是按位移位的,但您可以在自己的类中将其定义为您想要的任何内容。 Airflow 已将其定义为排序运算符。 -
+是数字的加法,也是字符串或列表的连接。这是一样的。>>是数字的位移位,但气流的顺序。 -
aah 运算符重载(如果我没记错的话)。
-
是的,这确实是正确的。
标签: python operators airflow bit-shift