From a97f0c4d965624b02f8a35242d94adbc8630afb6 Mon Sep 17 00:00:00 2001 From: vtr363 Date: Tue, 28 May 2024 11:38:37 -0300 Subject: [PATCH 1/3] Adiciona max_retries e retry_delay em get_raw_ftp --- pipelines/rj_smtr/veiculo/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/rj_smtr/veiculo/tasks.py b/pipelines/rj_smtr/veiculo/tasks.py index 74f07ca57..b2b7c2cfe 100644 --- a/pipelines/rj_smtr/veiculo/tasks.py +++ b/pipelines/rj_smtr/veiculo/tasks.py @@ -246,7 +246,7 @@ def pre_treatment_sppo_infracao(status: dict, timestamp: datetime): return {"data": data, "error": error} -@task +@task(max_retries=constants.MAX_RETRIES.value, retry_delay=constants.RETRY_DELAY.value) def get_raw_ftp( ftp_path: str, filetype: str, From 60a084352857db668926d49a77821b458892040d Mon Sep 17 00:00:00 2001 From: vtr363 Date: Tue, 28 May 2024 11:59:03 -0300 Subject: [PATCH 2/3] corrige retry_delay --- pipelines/rj_smtr/veiculo/tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pipelines/rj_smtr/veiculo/tasks.py b/pipelines/rj_smtr/veiculo/tasks.py index b2b7c2cfe..c21b094a2 100644 --- a/pipelines/rj_smtr/veiculo/tasks.py +++ b/pipelines/rj_smtr/veiculo/tasks.py @@ -5,7 +5,7 @@ import traceback import zipfile import io -from datetime import datetime +from datetime import datetime, timedelta import pandas as pd import numpy as np from prefect import task @@ -246,7 +246,10 @@ def pre_treatment_sppo_infracao(status: dict, timestamp: datetime): return {"data": data, "error": error} -@task(max_retries=constants.MAX_RETRIES.value, retry_delay=constants.RETRY_DELAY.value) +@task( + max_retries=constants.MAX_RETRIES.value, + retry_delay=timedelta(seconds=constants.RETRY_DELAY.value), +) def get_raw_ftp( ftp_path: str, filetype: str, From af0f3b6a26ce38141268613765bfa67c0c9b321a Mon Sep 17 00:00:00 2001 From: vtr363 Date: Tue, 28 May 2024 14:25:04 -0300 Subject: [PATCH 3/3] adiciona CHANGELOG.md --- pipelines/rj_smtr/veiculo/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pipelines/rj_smtr/veiculo/CHANGELOG.md b/pipelines/rj_smtr/veiculo/CHANGELOG.md index 741876b45..4058be5ea 100644 --- a/pipelines/rj_smtr/veiculo/CHANGELOG.md +++ b/pipelines/rj_smtr/veiculo/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog - veiculo +## [1.0.1] - 2024-05-28 + +### Adicionado + +- Adiciona retry a task `get_raw_ftp` para mitigar as falhas na captura (https://github.com/prefeitura-rio/pipelines/pull/694) + ## [1.0.0] - 2024-04-25 ### Alterado