Skip to content

Commit

Permalink
chore: netejar codi legacy de dags i dbt (et/somenergia-jardiner!142)
Browse files Browse the repository at this point in the history
Closes #219

Merge branch 'chore/nuke-219' into 'main'
  • Loading branch information
polmonso committed Apr 2, 2024
2 parents 2303ce3 + 9711c57 commit 847b11a
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 515 deletions.
12 changes: 5 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ variables:
SOMENERGIA_REGISTRY: $SOM_HARBOR_DADES_URL
DBT_PROJECT_DIR_NAME: dbt_jardiner
SOM_PROJECT_NAME: somenergia-jardiner
DBT_SKIP_STATE: "false"
IMAGE_NAME_PREFIX: $SOM_HARBOR_DADES_URL/$CI_PROJECT_NAME
IMAGE_NAME_APP: $IMAGE_NAME_PREFIX-app
IMAGE_NAME_APP_PRE_RELEASE: $IMAGE_NAME_APP:pre-release
Expand Down Expand Up @@ -135,7 +136,8 @@ dbt-build:
DBUSER: $SOM_JARDINER_DB_USER
DBPASSWORD: $SOM_JARDINER_DB_PASSWORD
DBNAME: $SOM_JARDINER_DB_DBNAME
DBT_MODELS_SELECTOR: "--models state:modified+"
DBT_MODELS_SELECTOR: "--models state:modified+ --defer"
DBT_STATE: "--state state/prod"
DBT_MANIFEST_ARTIFACT_URL: "https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/${CI_DEFAULT_BRANCH}/download?job=pages&job_token=$CI_JOB_TOKEN"
image: ${SOM_HARBOR_DADES_URL}/${SOM_PROJECT_NAME}-dbt-docs:latest
script:
Expand All @@ -146,31 +148,27 @@ dbt-build:
- curl --location --output /tmp/artifacts.zip ${DBT_MANIFEST_ARTIFACT_URL}
- unzip -o /tmp/artifacts.zip -d /tmp/artifacts
- cp /tmp/artifacts/public/dbt_docs/manifest.json ${CI_PROJECT_DIR}/${DBT_PROJECT_DIR_NAME}/state/prod/manifest.json
- dbt build --target ${DBT_TARGET_NAME} --store-failures --threads 4 ${DBT_MODELS_SELECTOR} --state state/prod
- dbt build --target ${DBT_TARGET_NAME} --store-failures --threads 4 ${DBT_MODELS_SELECTOR} ${DBT_STATE}
tags:
- somenergia-et
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"
when: always
variables:
DBT_TARGET_NAME: prod
DBT_MODELS_SELECTOR: "--models state:modified+"
changes:
paths: *dbt-build-changes-paths
allow_failure: false
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
variables:
DBT_MODELS_SELECTOR: "--models state:modified+ tag:dset_responses_fresh"
DBT_MODELS_SELECTOR: "--select tag:dset_responses_fresh state:modified+ +state:modified+,config.materialized:incremental +state:modified+,config.materialized:table --defer"
DBT_TARGET_NAME: pre
DBT_FAIL_FAST: "True"
changes:
compare_to: "refs/heads/main"
paths: *dbt-build-changes-paths
allow_failure: false
artifacts:
paths:
- ${CI_PROJECT_DIR}/${DBT_PROJECT_DIR_NAME}/target

release-app-image:
stage: release
Expand Down
2 changes: 1 addition & 1 deletion dags/dag_jardiner_dbt_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def dbapi_to_dict(dbapi: str) -> dict:
start_date=datetime(2024, 1, 28),
schedule_interval="30 22 * * *",
catchup=False,
tags=["jardiner", "dbt", "snapshot"],
tags=["project:jardiner", "dbt", "dbt-snapshot"],
max_active_runs=1,
default_args=args,
doc_md=__doc__,
Expand Down
14 changes: 7 additions & 7 deletions dags/dag_simel_mhcil_nas_mirror_from_minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ def get_random_moll():
schedule_interval="@daily",
catchup=False,
tags=[
"curve:MHCIL",
"scope:Jardiner",
"scope:Mercat",
"ingesta:historic",
"ingesta:minio",
"source:SIMEL",
"source:NAS",
"ingesta",
"project:jardiner",
"project:mercat",
"source:minio",
"source:mhcil",
"source:simel",
"source:nas",
],
default_args=args,
) as dag:
Expand Down
8 changes: 7 additions & 1 deletion dags/dbt_test_quality_dset.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ def dbapi_to_dict(dbapi: str):
start_date=datetime(2023, 12, 1, 0, 0, 0),
schedule_interval="0 3 * * *",
catchup=False,
tags=["Plantmonitor", "Jardiner", "test", "dbt", "data_quality"],
tags=[
"project:plantmonitor",
"project:jardiner",
"dbt-test",
"dbt",
"data-quality",
],
default_args=args,
doc_md=__doc__,
) as dag:
Expand Down
8 changes: 7 additions & 1 deletion dags/dset_materialize_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ def dbapi_to_dict(dbapi: str):
start_date=datetime(2023, 1, 10),
schedule_interval="3/10 * * * *",
catchup=False,
tags=["scope:Plantmonitor", "scope:Jardiner", "dbt", "source:DSET"],
tags=[
"project:plantmonitor",
"project:jardiner",
"dbt",
"dbt-run",
"source:dset-api",
],
max_active_runs=1,
default_args=args,
doc_md=__doc__,
Expand Down
7 changes: 6 additions & 1 deletion dags/generate_gitlab_ci_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
start_date=dt.datetime(2023, 9, 27),
catchup=False,
dagrun_timeout=dt.timedelta(minutes=10),
tags=["jardiner", "gitlab-ci", "pages"],
tags=[
"project:jardiner",
"gitlab-ci",
"gitlab-pages",
"experimental",
],
max_active_runs=1,
) as dag:
TOKEN = Variable.get("GITLAB_CI_TOKEN_JARDINER_PAGES")
Expand Down
81 changes: 0 additions & 81 deletions dags/jardineria_dag.py

This file was deleted.

179 changes: 0 additions & 179 deletions dags/plant_alerts.py

This file was deleted.

Loading

0 comments on commit 847b11a

Please sign in to comment.