Repository navigation
fix: janela das DAGs em BRT a partir do instante (regressão do #69 com pendulum) - #70
Merged
Merged
Conversation
Em produção o logical_date é pendulum.DateTime. Depois do #69, das 21:00 às 23:59 BRT a janela saiu invertida (start_date 2026-11-03, end_date 2026-11-02, logs da scraper-api a partir de 01:42Z de 03/11) e nada é raspado nesse horário. O teste usa um objeto que só expõe o instante (timestamp) e o tzinfo.
O logical_date do Airflow é pendulum.DateTime. Com ele, astimezone(ZoneInfo) seguido de subtração não preserva o fuso, e das 21:00 às 23:59 BRT a janela do #69 saiu invertida (start 03/11, end 02/11): nada é raspado nesse horário. A janela agora vem de datetime.fromtimestamp(logical_date.timestamp(), tz=America/Sao_Paulo), um datetime da stdlib.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumo
Corrige uma regressão do #69 na janela das DAGs
scrape_*.Em produção o
logical_datedo Airflow épendulum.DateTime. Com ele,astimezone(ZoneInfo)seguido de- timedelta(hours=1)devolve o resultado em outro fuso. Das 21:00 às 23:59 BRT, a janela do #69 saiu invertida: os logs da scraper-api00048-g2fmostramfrom 2026-11-03 to 2026-11-02a partir de 01:42Z de 03/11. Com a janela invertida, nada é raspado nesse horário.Reproduzido com pendulum 3:
2026-11-03 → 2026-11-022026-11-02 → 2026-11-022026-11-02 → 2026-11-032026-11-03 → 2026-11-03Mudança
_scrape_windowusa só o instante:datetime.fromtimestamp(logical_date.timestamp(), tz=America/Sao_Paulo), um datetime da stdlib, nas duas DAGs (scrape_agenciesescrape_ebc).test: … (red)acrescenta umlogical_dateque só expõetimestamp()etzinfoe falha se a função usar a aritmética, oastimezoneou ostrftimedo objeto;fix: …faz o teste passar.Testes
pytest -m "not integration": 761 passed.ruffnos arquivos alterados: OK.🤖 Generated with Claude Code