Pri*_*vas 8 airflow airflow-scheduler
我在气流 DAG 中运行 5 个 PythonOperator 任务,其中之一正在执行 ETL 作业,该作业需要很长时间,因此我的所有资源都被阻塞。有没有办法可以设置每个任务的最大执行时间,之后任务要么失败,要么通过消息标记为成功(以便 DAG 不会失败)?
Meg*_*Ray 12
在每个运算符中,我们都有一个execution_timeout
变量,您必须在其中传递一个datetime.timedelta
对象。
根据基本操作员代码注释:
:param execution_timeout: max time allowed for the execution of
this task instance, if it goes beyond it will raise and fail.
:type execution_timeout: datetime.timedelta
Run Code Online (Sandbox Code Playgroud)
另请记住,这将使 DAG 的单次运行失败并触发重新运行,并且只有在所有重新运行都失败时才会被声明为失败的 DAG。
因此,根据您分配的自动重试次数,您可能有一个潜在的最大时间,( number of retries ) x ( timeout )
以防代码持续花费太长时间。
归档时间: |
|
查看次数: |
33348 次 |
最近记录: |