11

I would like to set an SLA in a Sensor Operator. The documentation is not too clear about the use of it. So I did a test using the S3KeySensor operator which is looking for a file that does not exist. I set the SLA to 30 seconds, I was hoping to see the record after 30 seconds in the UI - in SLA misses - but it did not happen. What am I doing wrong?

inputsensor = S3KeySensor(
    task_id="check_for_files_in_s3",
    bucket_key="adp/backload/20136585/",
    wildcard_match=True,
    bucket_name="weblogs-raw",
    s3_conn_id="AWS_S3_CENTRAL",
    timeout=120,
    poke_interval=10,
    sla=timedelta(seconds=30),
    dag=dag,
)

inputsensor.set_downstream(next_step)
4

3 回答 3

8
"sla": timedelta(hours=2),

来自 Airflow Git 存储库的示例:airflow/example_dags/tutorial.py#L54

于 2017-06-16T23:54:09.397 回答
4

根据文档, SLA 表示计划周期结束后的时间增量。因此,如果您的计划时间间隔为1 小时'@daily'sla=timedelta(hours=1)那么 Airflow 将在凌晨 1:00 检查 SLA 未命中,这是计划周期结束加上一小时的时间。

于 2020-06-03T09:24:50.833 回答
1

以小时为单位

"sla": timedelta(hours=2)

在几分钟内

"sla": timedelta(minutes=120)
于 2020-05-19T05:20:10.170 回答