Skip to content

Commit

Permalink
Update elementary task
Browse files Browse the repository at this point in the history
  • Loading branch information
cayod committed Feb 26, 2024
1 parent b21bb18 commit a8f3c0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
24 changes: 1 addition & 23 deletions dags/stellar_etl_airflow/build_dbt_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from datetime import timedelta

from airflow.configuration import conf
from airflow.kubernetes.secret import Secret
from airflow.models import Variable
from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import (
KubernetesPodOperator,
Expand Down Expand Up @@ -66,22 +65,7 @@ def dbt_task(
operator="",
command_type="build",
resource_cfg="default",
alert=True,
):
secret_env = Secret(
deploy_type="env",
deploy_target="SLACK_TOKEN",
secret="slack-token-elementary",
key="token",
)
elementary_alert = [
"edr",
"monitor",
"--slack-token",
"$SLACK_TOKEN",
"--slack-channel-name",
"{{ var.value.slack_elementary_channel }}",
]
namespace = conf.get("kubernetes", "NAMESPACE")
if namespace == "default":
config_file_location = Variable.get("kube_config_location")
Expand All @@ -100,7 +84,7 @@ def dbt_task(

dbt_image = "{{ var.value.dbt_image_name }}"

args = ["dbt", command_type, f"--{flag}"]
args = [command_type, f"--{flag}"]

models = []
if tag:
Expand All @@ -118,10 +102,6 @@ def dbt_task(
if Variable.get("dbt_full_refresh_models", deserialize_json=True).get(task_name):
args.append("--full-refresh")

if alert:
args.append("&&")
args.extend(elementary_alert)

logging.info(f"sh commands to run in pod: {args}")

return KubernetesPodOperator(
Expand All @@ -145,9 +125,7 @@ def dbt_task(
"EXECUTION_DATE": "{{ ds }}",
},
image=dbt_image,
cmds=["sh", "-c"],
arguments=args,
secrets=[secret_env],
dag=dag,
do_xcom_push=True,
is_delete_operator_pod=True,
Expand Down
2 changes: 1 addition & 1 deletion dags/stellar_etl_airflow/build_elementary_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def elementary_task(
)
affinity = Variable.get("affinity", deserialize_json=True).get(resource_cfg)

dbt_image = "{{ var.value.dbt_image_name }}"
dbt_image = "us-central1-docker.pkg.dev/test-hubble-319619/stellar-dbt-elementary/stellar-dbt:latest"

logging.info(f"sh commands to run in pod: {args}")

Expand Down

0 comments on commit a8f3c0f

Please sign in to comment.