Skip to content

Commit

Permalink
Chore: consolidate NPS jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ifoukarakis committed Nov 5, 2024
1 parent f25dadf commit ff58c76
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 60 deletions.
57 changes: 0 additions & 57 deletions airflow/dags/mattermost_dags/general/daily_job.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from mattermost_dags.airflow_utils import MATTERMOST_DATAWAREHOUSE_IMAGE, pod_defaults, send_alert
from mattermost_dags.kube_secrets import (
NPS_WEBHOOK_URL,
SNOWFLAKE_ACCOUNT,
SNOWFLAKE_PASSWORD,
SNOWFLAKE_TRANSFORM_DATABASE,
Expand All @@ -27,11 +28,23 @@

# Create the DAG
dag = DAG(
"snowflake_job",
"nps_daily_feedback",
default_args=default_args,
schedule="0 0 * * *",
schedule="0 12 * * *",
catchup=False,
max_active_runs=1, # Don't allow multiple concurrent dag executions
doc_md="""
### Daily NPS Feedback
#### Purpose
This DAG updates NPS feedback and sends it to the appropriate channel once per day. It runs the following tasks:
- Calculate categories of feedback.
- Post NPS feedback to Mattermost channel.
#### Notes
- DAG was previously split in two parts, that resulted in data not being available.
""",
)


Expand Down Expand Up @@ -67,4 +80,24 @@ def get_container_operator(task_name, job_name, schema):
"nps-subcategory-updates", "data_action_nps_feedback_subcategory_update", "mattermost"
)

automated_nps_feedback_category_update >> nps_subcategory_updates >> nps_category_updates

post_nps_feedback = KubernetesPodOperator(
**pod_defaults,
image=MATTERMOST_DATAWAREHOUSE_IMAGE, # Uses latest build from master
task_id="post-nps-feedback",
name="post-nps-feedback",
secrets=[
SNOWFLAKE_ACCOUNT,
SNOWFLAKE_USER,
SNOWFLAKE_PASSWORD,
SNOWFLAKE_TRANSFORM_ROLE,
SNOWFLAKE_TRANSFORM_WAREHOUSE,
SNOWFLAKE_TRANSFORM_SCHEMA,
SNOWFLAKE_TRANSFORM_DATABASE,
NPS_WEBHOOK_URL,
],
arguments=["python -m utils.post_nps_data"],
dag=dag,
)

automated_nps_feedback_category_update >> nps_subcategory_updates >> nps_category_updates >> post_nps_feedback

0 comments on commit ff58c76

Please sign in to comment.