Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adiciona captura do RDO/RHO de vans (STPL) #466

Closed
wants to merge 136 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
a521afc
add stpl rdo/rho capture
Hellcassius Jun 27, 2023
df294ea
fix pylint set_redis_rdo_files
eng-rodrigocunha Jun 27, 2023
87fc639
minor fix on error logging
Hellcassius Jun 27, 2023
358e2a2
Merge branch 'staging/smtr-add-stpl-rdo' of https://github.com/prefei…
Hellcassius Jun 27, 2023
6408656
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jul 3, 2023
719fff9
Merge branch 'master' into staging/smtr-add-stpl-rdo
eng-rodrigocunha Jul 6, 2023
cf0067f
Revert "chore: upgrade prefect to 1.4"
eng-rodrigocunha Jul 6, 2023
eb39931
Merge branch 'staging/smtr-add-stpl-rdo' of https://github.com/prefei…
eng-rodrigocunha Jul 6, 2023
b211c2a
add code_owners
eng-rodrigocunha Jul 6, 2023
871dc70
Add code_owners
eng-rodrigocunha Jul 6, 2023
94f72ba
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jul 7, 2023
ea48896
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jul 7, 2023
bd225ee
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jul 17, 2023
7c093cd
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jul 25, 2023
f7bf947
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jul 25, 2023
d9144df
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Aug 7, 2023
3942c5c
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Aug 10, 2023
1c7109c
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Aug 14, 2023
faa2af3
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Aug 16, 2023
86aa946
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Aug 16, 2023
08323cd
Merge branch 'master' into staging/smtr-add-stpl-rdo
eng-rodrigocunha Sep 25, 2023
b4abc7e
change flow names + change agent + remove redis
eng-rodrigocunha Sep 25, 2023
9e24252
update file list
eng-rodrigocunha Sep 25, 2023
b6089fa
remove task de particao nao usada
fernandascovino Sep 25, 2023
dc197cc
unifica tasks de particao de data e hora
fernandascovino Sep 25, 2023
66e84a1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 25, 2023
7cb436b
corrige condicional
fernandascovino Sep 25, 2023
90664e2
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Sep 26, 2023
8903027
Merge branch 'master' into hotfix-smtr-partition-date-only
mergify[bot] Sep 26, 2023
588fe7d
change capture flow
pixuimpou Sep 26, 2023
8aee59f
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Sep 26, 2023
da92c19
Merge branch 'master' into hotfix-smtr-partition-date-only
mergify[bot] Sep 26, 2023
97746e1
change generic capture flow
pixuimpou Sep 26, 2023
7a11896
Merge branch 'master' into staging/flow-captura-generico
fernandascovino Sep 26, 2023
b62473c
Merge branch 'hotfix-smtr-partition-date-only' into staging/flow-capt…
fernandascovino Sep 26, 2023
6f12477
atualiza esquema do flow padrao
fernandascovino Sep 26, 2023
0c3df1b
change default capture flow structure
pixuimpou Sep 27, 2023
f6ca7ab
change generic capture flow
pixuimpou Sep 27, 2023
fa17be2
adjust constant structure
pixuimpou Sep 27, 2023
bdc3881
change bilhetagem to new capture flow structure
pixuimpou Sep 27, 2023
fc61c47
fix get_storage_blob function
pixuimpou Sep 27, 2023
0fc26cb
fix get_storage_blob call
pixuimpou Sep 27, 2023
634df85
organize constants order
pixuimpou Sep 27, 2023
bda52aa
fix get_raw_from_sources function call
pixuimpou Sep 27, 2023
b2548d6
change transform_raw_to_json to read_raw_data
pixuimpou Sep 27, 2023
307863a
transform transform_raw_data_to_json to read_raw_data
pixuimpou Sep 27, 2023
7f2c1e3
fix nout task parameter
pixuimpou Sep 27, 2023
51977c1
fix timedelta instantiation
pixuimpou Sep 27, 2023
8ef0b5d
set upstream tasks
pixuimpou Sep 27, 2023
4f21f0a
declare raw_filepath
pixuimpou Sep 27, 2023
11b9735
update docstrings
eng-rodrigocunha Sep 27, 2023
f484b88
adjust get_raw_from_sources return
pixuimpou Sep 27, 2023
50626a9
Merge branch 'staging/flow-captura-generico' of https://github.com/pr…
pixuimpou Sep 27, 2023
2df4318
fix errors
pixuimpou Sep 27, 2023
df6525a
change agent label to dev
pixuimpou Sep 27, 2023
2983b68
refactore source values
pixuimpou Sep 28, 2023
2c78b09
update constants
eng-rodrigocunha Sep 28, 2023
1f3c2fc
update agent
eng-rodrigocunha Sep 28, 2023
702e70d
update schedule params
eng-rodrigocunha Sep 28, 2023
b5712d2
update interval
eng-rodrigocunha Sep 28, 2023
e3df22c
fix get_datetime_range interval
eng-rodrigocunha Sep 28, 2023
6ed06da
remove order by from queries
eng-rodrigocunha Sep 28, 2023
822c59f
fix get_raw_data_api
eng-rodrigocunha Sep 28, 2023
e45edf7
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Sep 28, 2023
f3ddf24
Merge branch 'master' into staging/flow-captura-generico
mergify[bot] Sep 28, 2023
5203627
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Sep 28, 2023
14dd234
Merge branch 'master' into staging/flow-captura-generico
mergify[bot] Sep 28, 2023
c58ea96
change json read function
pixuimpou Sep 28, 2023
045a423
update read_raw_data
lingsv Sep 28, 2023
d2d188f
update save_raw_local_func
lingsv Sep 28, 2023
b7c4e2f
log error
pixuimpou Sep 28, 2023
2bedf89
change raw api extraction for json
pixuimpou Sep 28, 2023
20b48df
change read json function
pixuimpou Sep 28, 2023
42c6ac0
print log traceback
pixuimpou Sep 28, 2023
78cbcb4
Merge branches 'staging/smtr-add-stpl-rdo' and 'staging/flow-captura-…
eng-rodrigocunha Sep 28, 2023
2a1a25d
enrich logs
eng-rodrigocunha Sep 28, 2023
0cf7188
treat error
eng-rodrigocunha Sep 29, 2023
dbdbffe
update to connect just once
eng-rodrigocunha Sep 29, 2023
0d1e0a3
Merge branch 'master' into staging/smtr-add-stpl-rdo
eng-rodrigocunha Sep 29, 2023
95df909
Merge branch 'master' into staging/smtr-add-stpl-rdo
eng-rodrigocunha Oct 2, 2023
c68d376
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 2, 2023
8da9b9d
update utils
eng-rodrigocunha Oct 2, 2023
2732aa9
update utils
eng-rodrigocunha Oct 2, 2023
fec51a2
update constants
eng-rodrigocunha Oct 2, 2023
a7e47e7
atualiza estrutura de ftp_client
eng-rodrigocunha Oct 2, 2023
8075fd6
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 2, 2023
fa6dfbe
altera para o agent anterior
eng-rodrigocunha Oct 2, 2023
8be8f0c
remove task connect_ftp_task
eng-rodrigocunha Oct 2, 2023
cb38e92
cria task download_and_save_list_local_from_ftp
eng-rodrigocunha Oct 2, 2023
20d0d81
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 3, 2023
b97433f
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 5, 2023
fc77487
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 5, 2023
68ebd07
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 5, 2023
75feee8
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 23, 2023
5ff9e1f
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 23, 2023
b3ff962
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 23, 2023
cec5daf
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 24, 2023
5387846
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 24, 2023
803950d
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 24, 2023
96dafaf
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 26, 2023
a6ced1c
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 27, 2023
1719caf
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Oct 27, 2023
a94879d
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 13, 2023
420c5b9
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 13, 2023
5442e16
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 13, 2023
0dae46e
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 13, 2023
fc22a67
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 13, 2023
cceb77a
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 14, 2023
d7110d4
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 14, 2023
928bfa6
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 15, 2023
ddfe6dc
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 15, 2023
e1df0c9
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 15, 2023
5a09882
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 19, 2023
c588117
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 19, 2023
5968ed6
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Nov 24, 2023
78b21db
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 11, 2023
e6181cf
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 12, 2023
e5307a0
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 12, 2023
ee04dba
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 12, 2023
b105cad
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 13, 2023
c0c10a1
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 14, 2023
24c4d9d
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 14, 2023
caf48d8
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 18, 2023
09f3331
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 18, 2023
e4d36cb
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 18, 2023
35ee4f9
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 18, 2023
f855486
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Dec 21, 2023
421a99d
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 2, 2024
f883b8a
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 8, 2024
508619e
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 14, 2024
c109afd
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 15, 2024
48c70da
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 15, 2024
5c177be
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 16, 2024
f9989b7
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 16, 2024
fe23487
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 18, 2024
e7a9292
Merge branch 'master' into staging/smtr-add-stpl-rdo
mergify[bot] Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 99 additions & 2 deletions pipelines/rj_smtr/br_rj_riodejaneiro_rdo/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
)

with Flow(
"SMTR: RHO - Captura",
"SMTR: SPPO RHO - Captura",
code_owners=["caio", "fernanda"],
) as captura_sppo_rho:
# SETUP
Expand Down Expand Up @@ -145,7 +145,7 @@
captura_sppo_rho.schedule = every_day

with Flow(
"SMTR: RDO - Captura",
"SMTR: SPPO RDO - Captura",
code_owners=["caio", "fernanda"],
) as captura_sppo_rdo:
# SETUP
Expand Down Expand Up @@ -193,6 +193,103 @@
captura_sppo_rdo.schedule = every_day


with Flow(
"SMTR: STPL RHO - Captura",
code_owners=["caio", "fernanda"],
) as captura_stpl_rho:
# SETUP
transport_mode = Parameter("transport_mode", "STPL")
report_type = Parameter("report_type", "RHO")
dump = Parameter("dump", False)
table_id = Parameter("table_id", constants.STPL_RHO_TABLE_ID.value)
materialize = Parameter("materialize", False)

rename_run = rename_current_flow_run_now_time(
prefix=f"Captura FTP - {transport_mode.run()}-{report_type.run()} ",
now_time=get_current_timestamp(),
wait=None,
)
# EXTRACT
files = get_file_paths_from_ftp(
transport_mode=transport_mode, report_type=report_type, dump=dump
)
download_files = check_files_for_download(
files=files, dataset_id=constants.RDO_DATASET_ID.value, table_id=table_id
)
updated_info = download_and_save_local_from_ftp.map(file_info=download_files)
# TRANSFORM
treated_path, raw_path, partitions, status = pre_treatment_br_rj_riodejaneiro_rdo(
files=updated_info
)
# LOAD
errors = bq_upload.map(
dataset_id=unmapped(constants.RDO_DATASET_ID.value),
table_id=unmapped(table_id),
filepath=treated_path,
raw_filepath=raw_path,
partitions=partitions,
status=status,
)
set_redis = update_rdo_redis(
download_files=download_files, table_id=table_id, errors=errors
)

captura_stpl_rho.storage = GCS(emd_constants.GCS_FLOWS_BUCKET.value)
captura_stpl_rho.run_config = KubernetesRun(
image=emd_constants.DOCKER_IMAGE.value,
labels=[emd_constants.RJ_SMTR_AGENT_LABEL.value],
)
captura_stpl_rho.schedule = every_day

with Flow(
"SMTR: STPL RDO - Captura",
code_owners=["caio", "fernanda"],
) as captura_stpl_rdo:
# SETUP
transport_mode = Parameter("transport_mode", "STPL")
report_type = Parameter("report_type", "RDO")
dump = Parameter("dump", False)
table_id = Parameter("table_id", constants.STPL_RDO_TABLE_ID.value)
materialize = Parameter("materialize", False)

rename_run = rename_current_flow_run_now_time(
prefix=f"Captura FTP - {transport_mode.run()}-{report_type.run()} ",
now_time=get_current_timestamp(),
wait=None,
)
# EXTRACT
files = get_file_paths_from_ftp(
transport_mode=transport_mode, report_type=report_type, dump=dump
)
download_files = check_files_for_download(
files=files, dataset_id=constants.RDO_DATASET_ID.value, table_id=table_id
)
updated_info = download_and_save_local_from_ftp.map(file_info=download_files)
# TRANSFORM
treated_path, raw_path, partitions, status = pre_treatment_br_rj_riodejaneiro_rdo(
files=updated_info
)
# LOAD
errors = bq_upload.map(
dataset_id=unmapped(constants.RDO_DATASET_ID.value),
table_id=unmapped(table_id),
filepath=treated_path,
raw_filepath=raw_path,
partitions=partitions,
status=status,
)
set_redis = update_rdo_redis(
download_files=download_files, table_id=table_id, errors=errors
)

captura_stpl_rdo.storage = GCS(emd_constants.GCS_FLOWS_BUCKET.value)
captura_stpl_rdo.run_config = KubernetesRun(
image=emd_constants.DOCKER_IMAGE.value,
labels=[emd_constants.RJ_SMTR_AGENT_LABEL.value],
)
captura_stpl_rdo.schedule = every_day


# captura_sppo_rho = deepcopy(captura_sppo_rdo)
# captura_sppo_rho.storage = GCS(emd_constants.GCS_FLOWS_BUCKET.value)
# captura_sppo_rho.run_config = KubernetesRun(image=emd_constants.DOCKER_IMAGE.value)