Skip to content

Commit

Permalink
Adjust env var per Dhruv's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
krysal committed Feb 7, 2024
1 parent fd1239b commit 37396ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions catalog/dags/common/cloudwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"""

import logging

import boto3
from botocore.exceptions import ClientError
from airflow.models import Variable
from botocore.exceptions import ClientError


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -49,8 +51,8 @@ def enable_alarm_actions(self, alarm_name, enable):


def enable_or_disable_alarms(enable):
skip_toggling = Variable.get("SKIP_TOGGLING_CLOUDWATCH_ALARMS", False)
if skip_toggling:
toggle = Variable.get("TOGGLE_CLOUDWATCH_ALARMS", True)
if not toggle:
logger.info("Skipping toggling CloudWatch alarms.")
return

Expand Down
2 changes: 1 addition & 1 deletion catalog/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ AWS_SECRET_KEY=test_secret
OPENVERSE_BUCKET=openverse-storage
# Whether to toggle production CloudWatch alarms when running a data refresh DAG.
# Used to prevent requiring AWS credentials when running locally.
AIRFLOW_VAR_SKIP_TOGGLING_CLOUDWATCH_ALARMS=false
AIRFLOW_VAR_TOGGLE_CLOUDWATCH_ALARMS=true
# Seconds to wait before poking for availability of the data refresh pool when running a data_refresh
# DAG. Used to shorten the time for testing purposes.
DATA_REFRESH_POKE_INTERVAL=5
Expand Down

0 comments on commit 37396ef

Please sign in to comment.