Skip to content

Commit

Permalink
Add dag to create elementary report
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Oct 3, 2024
1 parent 8fa15b8 commit d36a520
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
32 changes: 32 additions & 0 deletions dags/elementary_report_dag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from datetime import datetime

from airflow import DAG
from airflow.operators.empty import EmptyOperator
from kubernetes.client import models as k8s
from stellar_etl_airflow.build_dbt_task import dbt_task
from stellar_etl_airflow.build_elementary_slack_alert_task import elementary_task
from stellar_etl_airflow.default import (
alert_sla_miss,
get_default_dag_args,
init_sentry,
)

init_sentry()

with DAG(
"elementary_report",
default_args=get_default_dag_args(),
start_date=datetime(2024, 6, 25, 0, 0),
description="This DAG creates elementary report and send it to slack",
schedule="*/60 * * * *", # Runs every 60 minutes
user_defined_filters={
"container_resources": lambda s: k8s.V1ResourceRequirements(requests=s),
},
max_active_runs=1,
catchup=False,
) as dag:

# Trigger elementary
elementary_alerts = elementary_task(dag, "generate_report", resource_cfg="dbt",command="send-report")

elementary_alerts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def elementary_task(
dag,
task_name,
resource_cfg="default",
command="monitor"
):
namespace = conf.get("kubernetes", "NAMESPACE")

Expand All @@ -45,7 +46,7 @@ def elementary_task(
slack_secret_name = Variable.get("dbt_elementary_secret")
secret = access_secret(slack_secret_name, "default")
args = [
"monitor",
f"{command}",
"--slack-token",
f"{secret}",
"--slack-channel-name",
Expand Down

0 comments on commit d36a520

Please sign in to comment.