From 11ba5583f1d7b030ff96caa10a74745983abea94 Mon Sep 17 00:00:00 2001 From: Krystle Salazar Date: Wed, 31 Jan 2024 15:13:33 -0400 Subject: [PATCH] Adjust env var per Dhruv's suggestion --- catalog/dags/common/cloudwatch.py | 8 +++++--- catalog/env.template | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/catalog/dags/common/cloudwatch.py b/catalog/dags/common/cloudwatch.py index 2ebb33f1b61..1ac3b985426 100644 --- a/catalog/dags/common/cloudwatch.py +++ b/catalog/dags/common/cloudwatch.py @@ -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__) @@ -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 diff --git a/catalog/env.template b/catalog/env.template index 02c0cf016ed..d2064aeaf66 100644 --- a/catalog/env.template +++ b/catalog/env.template @@ -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