Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Removed connection ID variables in favour of simply defining (#2386)
duwarakan7e1783570d3a
diff --git a/catalog/dags/common/constants.py b/catalog/dags/common/constants.pyindex 6cdef64b2..40fcaa9c4 100644--- a/catalog/dags/common/constants.py+++ b/catalog/dags/common/constants.py@@ -29,11 +29,9 @@ DAG_DEFAULT_ARGS = {}XCOM_PULL_TEMPLATE = "{{{{ ti.xcom_pull(task_ids='{}', key='{}') }}}}"-POSTGRES_CONN_ID = os.getenv("OPENLEDGER_CONN_ID", "postgres_openledger_testing")-OPENLEDGER_API_CONN_ID = os.getenv("OPENLEDGER_API_CONN_ID", "postgres_openledger_api")-POSTGRES_API_STAGING_CONN_ID = os.getenv(- "POSTGRES_API_STAGING_CONN_ID", "postgres_openledger_api_staging"-)-AWS_CONN_ID = os.getenv("AWS_CONN_ID", "aws_conn_id")+POSTGRES_CONN_ID = "postgres_openledger_upstream"+OPENLEDGER_API_CONN_ID = "postgres_openledger_api"+POSTGRES_API_STAGING_CONN_ID = "postgres_openledger_api_staging"+AWS_CONN_ID = "aws_default"AWS_RDS_CONN_ID = os.environ.get("AWS_RDS_CONN_ID", AWS_CONN_ID)ES_PROD_HTTP_CONN_ID = "elasticsearch_http_production"diff --git a/catalog/env.template b/catalog/env.templateindex 35b928264..67138290b 100644--- a/catalog/env.template+++ b/catalog/env.template@@ -52,7 +52,6 @@ AIRFLOW_CONN_AWS_DEFAULT=aws://test_key:test_secret@?region_name=us-east-1&endpoAIRFLOW_CONN_POSTGRES_OPENLEDGER_UPSTREAM=postgres://deploy:deploy@upstream_db:5432/openledgerAIRFLOW_CONN_POSTGRES_OPENLEDGER_TESTING=postgres://deploy:deploy@upstream_db:5432/openledgerAIRFLOW_CONN_POSTGRES_OPENLEDGER_API_STAGING=postgres://deploy:deploy@db:5432/openledger-OPENLEDGER_CONN_ID=postgres_openledger_upstreamTEST_CONN_ID=postgres_openledger_testing# Elasticsearch connections. Change the following line in prod to use the appropriate DB.@@ -60,7 +59,6 @@ AIRFLOW_CONN_ELASTICSEARCH_HTTP_PRODUCTION=http://es:9200# API DB connection. Change the following line in prod to use the appropriate DBAIRFLOW_CONN_POSTGRES_OPENLEDGER_API=postgres://deploy:deploy@db:5432/openledger-OPENLEDGER_API_CONN_ID=postgres_openledger_api# Slack webhook connection info (note that these values are modified by the Docker entrypoint)# A distinction is made here between "notifications" and "alerts", the former being@@ -69,13 +67,6 @@ AIRFLOW_CONN_SLACK_NOTIFICATIONS=https://slackAIRFLOW_CONN_SLACK_ALERTS=https://slackS3_LOCAL_ENDPOINT=http://s3:5000-AWS_CONN_ID=aws_default--AIRFLOW_CONN_EMR_EMPTY=emr://-AIRFLOW_CONN_EMR_TEST=emr://?host=http://s3:5000--EMR_CONN_ID=emr_empty-EMR_TEST_CONN_ID=emr_test# Connection to the Ingestion Server, used for managing data refreshes. Default is used to# connect to your locally running ingestion server.diff --git a/catalog/tests/dags/common/conftest.py b/catalog/tests/dags/common/conftest.pyindex 102107b67..1a97d5b3a 100644--- a/catalog/tests/dags/common/conftest.py+++ b/catalog/tests/dags/common/conftest.py@@ -17,6 +17,9 @@ from common.constants import POSTGRES_CONN_IDfrom common.sql import PGExecuteQueryOperator, PostgresHook+POSTGRES_TEST_CONN_ID = "postgres_openledger_testing"++def _delete_bucket(bucket):key_list = [{"Key": obj.key} for obj in bucket.objects.all()]if len(list(bucket.objects.all())) > 0:diff --git a/catalog/tests/dags/common/loader/test_sql.py b/catalog/tests/dags/common/loader/test_sql.pyindex b3c48aa6e..628f9d3a1 100644--- a/catalog/tests/dags/common/loader/test_sql.py+++ b/catalog/tests/dags/common/loader/test_sql.py@@ -10,6 +10,7 @@ import pytestfrom flaky import flakyfrom psycopg2.errors import InvalidTextRepresentation+from catalog.tests.dags.common.conftest import POSTGRES_TEST_CONN_ID as POSTGRES_CONN_IDfrom catalog.tests.dags.common.popularity.test_sql import (TableInfo,_set_up_std_popularity_func,@@ -19,7 +20,6 @@ from common.loader import sqlfrom common.storage import columns as col-POSTGRES_CONN_ID = os.getenv("TEST_CONN_ID")RESOURCES = os.path.join(os.path.abspath(os.path.dirname(__file__)), "test_resources")diff --git a/catalog/tests/dags/common/popularity/test_sql.py b/catalog/tests/dags/common/popularity/test_sql.pyindex b1d4eed7b..1573a6f80 100644--- a/catalog/tests/dags/common/popularity/test_sql.py+++ b/catalog/tests/dags/common/popularity/test_sql.py@@ -8,13 +8,13 @@ from typing import NamedTupleimport psycopg2import pytest+from catalog.tests.dags.common.conftest import POSTGRES_TEST_CONN_ID as POSTGRES_CONN_IDfrom common.loader.sql import create_column_definitionsfrom common.popularity import sqlfrom common.storage.db_columns import IMAGE_TABLE_COLUMNSDDL_DEFINITIONS_PATH = Path(__file__).parents[5] / "docker" / "upstream_db"-POSTGRES_CONN_ID = os.getenv("TEST_CONN_ID")POSTGRES_TEST_URI = os.getenv("AIRFLOW_CONN_POSTGRES_OPENLEDGER_TESTING")diff --git a/catalog/tests/dags/common/test_sql.py b/catalog/tests/dags/common/test_sql.pyindex af5f09165..6d4417d87 100644--- a/catalog/tests/dags/common/test_sql.py+++ b/catalog/tests/dags/common/test_sql.py@@ -1,5 +1,4 @@import logging-import osfrom datetime import datetime, timedeltaimport pytest@@ -13,7 +12,6 @@ from common.sql import PGExecuteQueryOperator, PostgresHooklogger = logging.getLogger(__name__)-POSTGRES_TEST_CONN_ID = os.getenv("TEST_CONN_ID")DEFAULT_TIMEOUT = timedelta(hours=1).total_seconds()default_timeout_msg = (f"DAG_DEFAULT_ARGS sets the default task execution timeout to "