Skip to content

Commit

Permalink
Cria parâmetro project_name + Inclui argumento run_config no flow…
Browse files Browse the repository at this point in the history
… `gtfs_captura_tratamento` (#678)

* commit inicial

* Atualiza changelog

* Adiciona run_config em referência ao flow principal ao criar as runs

* Atualiza changelog

* Enriquece logs

* Remove log de informações sensíveis

* Retora agente para produção

* Altera SUBSIDIO_SPPO_CODE_OWNERS
  • Loading branch information
eng-rodrigocunha authored Jun 3, 2024
1 parent 9b1775d commit 936b265
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pipelines/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,8 @@ class constants(Enum): # pylint: disable=c0103
"user_id": "1147152438487416873",
"type": "user_nickname",
},
"dados_smtr": {
"user_id": "1056928259700445245",
"type": "role",
},
}
7 changes: 7 additions & 0 deletions pipelines/rj_smtr/br_rj_riodejaneiro_gtfs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog - br_rj_riodejaneiro_gtfs

## [1.0.1] - 2024-05-10

### Alterado

- Cria parâmetro `project_name` no flow `gtfs_captura_tratamento` para possibilitar alterar o `project_name` ao usar a task `create_flow_run` (https://github.com/prefeitura-rio/pipelines/pull/678)
- Inclui argumento `run_config` ao usar a task `create_flow_run`, usando sempre como referência a `run_config` do flow principal (https://github.com/prefeitura-rio/pipelines/pull/678)

## [1.0.0] - 2024-04-18

### Adicionado
Expand Down
8 changes: 6 additions & 2 deletions pipelines/rj_smtr/br_rj_riodejaneiro_gtfs/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
data_versao_gtfs = Parameter("data_versao_gtfs", default=None)
capture = Parameter("capture", default=True)
materialize = Parameter("materialize", default=True)
project_name = Parameter(
"project_name", default=emd_constants.PREFECT_DEFAULT_PROJECT.value
)

timestamp = get_current_timestamp()

Expand All @@ -84,14 +87,15 @@

run_captura = create_flow_run.map(
flow_name=unmapped(gtfs_captura.name),
project_name=unmapped(emd_constants.PREFECT_DEFAULT_PROJECT.value),
project_name=unmapped(project_name),
parameters=gtfs_capture_parameters,
labels=unmapped(LABELS),
scheduled_start_time=get_scheduled_start_times(
timestamp=timestamp,
parameters=gtfs_capture_parameters,
intervals={"agency": timedelta(minutes=11)},
),
run_config=unmapped(gtfs_captura_tratamento.run_config),
)

wait_captura_true = wait_for_flow_run.map(
Expand Down Expand Up @@ -120,7 +124,7 @@

run_materializacao = create_flow_run(
flow_name=gtfs_materializacao.name,
project_name=emd_constants.PREFECT_DEFAULT_PROJECT.value,
project_name=project_name,
parameters=gtfs_materializacao_parameters,
labels=LABELS,
upstream_tasks=[wait_captura],
Expand Down
2 changes: 1 addition & 1 deletion pipelines/rj_smtr/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class constants(Enum): # pylint: disable=c0103
SUBSIDIO_SPPO_DATASET_ID = "projeto_subsidio_sppo"
SUBSIDIO_SPPO_SECRET_PATH = "projeto_subsidio_sppo"
SUBSIDIO_SPPO_TABLE_ID = "viagem_completa"
SUBSIDIO_SPPO_CODE_OWNERS = ["rodrigo"]
SUBSIDIO_SPPO_CODE_OWNERS = ["dados_smtr"]

# SUBSÍDIO DASHBOARD
SUBSIDIO_SPPO_DASHBOARD_DATASET_ID = "dashboard_subsidio_sppo"
Expand Down

0 comments on commit 936b265

Please sign in to comment.