Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Bump Airflow to 2.4.0, standardize version bump process (#737)

Madison Swain-Bowdenb4ef93ce5f82
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 026a1d7ba..7cba455c9 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -54,6 +54,10 @@ jobs:
id: python-version
run: echo "::set-output name=value::$(just py-version)"
+ - name: Get Airflow version
+ id: airflow-version
+ run: echo "::set-output name=value::$(just airflow-version)"
+
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
with:
@@ -70,6 +74,7 @@ jobs:
outputs: type=docker,dest=/tmp/catalog.tar
build-args: |
PROJECT_PY_VERSION=${{ steps.python-version.outputs.value }}
+ PROJECT_AIRFLOW_VERSION=${{ steps.airflow-version.outputs.value }}
- name: Upload image
uses: actions/upload-artifact@v2
diff --git a/DAGs.md b/DAGs.md
index b741d27fd..c09916317 100644
--- a/DAGs.md
+++ b/DAGs.md
@@ -161,7 +161,6 @@ airflow dags trigger --conf
- enableDelete:<BOOLEAN> - Optional
-
## `audio_data_refresh`
### Data Refresh DAG Factory
@@ -219,7 +218,6 @@ after the issue has been resolved.
The DAG runs weekly.
-
## `europeana_reingestion_workflow`
@@ -233,7 +231,6 @@ Output: TSV file containing the images and the
Notes: https://www.europeana.eu/api/v2/search.json
-
## `europeana_workflow`
@@ -247,7 +244,6 @@ Output: TSV file containing the images and the
Notes: https://www.europeana.eu/api/v2/search.json
-
## `flickr_reingestion_workflow`
@@ -262,7 +258,6 @@ Notes: https://www.flickr.com/help/terms/api
Rate limit: 3600 requests per hour.
-
## `flickr_workflow`
@@ -277,7 +272,6 @@ Notes: https://www.flickr.com/help/terms/api
Rate limit: 3600 requests per hour.
-
## `freesound_workflow`
@@ -292,7 +286,6 @@ Notes: https://freesound.org/apiv2/search/text'
No rate limit specified.
-
## `image_data_refresh`
### Data Refresh DAG Factory
@@ -351,7 +344,6 @@ Notes: [The iNaturalist API is not intended for data scraping.]
except for adding ancestry tags to the taxa table.
-
## `jamendo_workflow`
@@ -372,7 +364,6 @@ Notes: https://api.jamendo.com/v3.0/tracks/
channels: 1/2
-
## `metropolitan_museum_workflow`
@@ -402,7 +393,6 @@ Notes: https://metmuseum.github.io/#search
-
## `oauth2_authorization`
### OAuth Provider Authorization
@@ -455,7 +445,6 @@ Notes: http://phylopic.org/api/
No rate limit specified.
-
## `pr_review_reminders`
@@ -479,7 +468,6 @@ author of the PR to re-assign review if one of the randomly selected reviewers
is unavailable for the time period during which the PR should be reviewed.
-
## `recreate_audio_popularity_calculation`
@@ -493,7 +481,6 @@ These DAGs are not on a schedule, and should only be run manually when new
SQL code is deployed for the calculation.
-
## `recreate_image_popularity_calculation`
@@ -507,7 +494,6 @@ These DAGs are not on a schedule, and should only be run manually when new
SQL code is deployed for the calculation.
-
## `report_pending_reported_media`
### Report Pending Reported Media DAG
@@ -534,7 +520,6 @@ Output: TSV file containing the images and the respective
Notes: None
-
## `stocksnap_workflow`
@@ -551,7 +536,6 @@ Notes: https://stocksnap.io/api/load-photos/date/desc/1
API is undocumented.
-
## `tsv_to_postgres_loader`
#### Database Loader DAG
@@ -602,7 +586,6 @@ https://github.com/creativecommons/cccatalog/issues/334)
-
## `walters_workflow`
@@ -617,7 +600,6 @@ Notes: http://api.thewalters.org/
Rate limit: 250000 Per Day Per Key
-
## `wikimedia_commons_workflow`
@@ -632,7 +614,6 @@ Notes: https://commons.wikimedia.org/wiki/API:Main_page
No rate limit specified.
-
## `wikimedia_reingestion_workflow`
@@ -647,7 +628,6 @@ Notes: https://commons.wikimedia.org/wiki/API:Main_page
No rate limit specified.
-
## `wordpress_workflow`
diff --git a/docker-compose.override.yml b/docker-compose.override.yml
index 5087335fb..38dc8a801 100644
--- a/docker-compose.override.yml
+++ b/docker-compose.override.yml
@@ -86,6 +86,7 @@ services:
args:
- REQUIREMENTS_FILE=requirements_dev.txt
- PROJECT_PY_VERSION=${PROJECT_PY_VERSION}
+ - PROJECT_AIRFLOW_VERSION=${PROJECT_AIRFLOW_VERSION}
dockerfile: docker/airflow/Dockerfile
restart: on-failure
# This command ensures an admin account is created on startup
diff --git a/docker/airflow/Dockerfile b/docker/airflow/Dockerfile
index a1b5a95fe..db64d79b7 100644
--- a/docker/airflow/Dockerfile
+++ b/docker/airflow/Dockerfile
@@ -43,7 +43,6 @@ RUN useradd -m -d ${AIRFLOW_HOME} airflow && \
chown airflow:airflow ${OUTPUT_DIR}
USER airflow
-ARG AIRFLOW_VERSION=2.3.4
WORKDIR ${AIRFLOW_HOME}
# Always add the prod req because the dev reqs depend on it for deduplication
COPY ${REQUIREMENTS_FILE} requirements_prod.txt ${AIRFLOW_HOME}/
@@ -51,9 +50,10 @@ COPY docker/airflow/wait_for_db.py /opt/airflow/
# args go out of scope when a new build stage starts so it must be redeclared here
ARG PROJECT_PY_VERSION
+ARG PROJECT_AIRFLOW_VERSION
# https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html#constraints-files
-ARG CONSTRAINTS_FILE="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PROJECT_PY_VERSION}.txt"
+ARG CONSTRAINTS_FILE="https://raw.githubusercontent.com/apache/airflow/constraints-${PROJECT_AIRFLOW_VERSION}/constraints-${PROJECT_PY_VERSION}.txt"
RUN pip install --user -r ${REQUIREMENTS_FILE} -c ${CONSTRAINTS_FILE}
diff --git a/env.template b/env.template
index 33264748f..2f913c901 100644
--- a/env.template
+++ b/env.template
@@ -43,7 +43,7 @@ AIRFLOW_VAR_API_KEY_FREESOUND=not_set
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres:5432/airflow
# Remote logging connection ID
# Replace "access_key" and "secret+key" with the real values. Secret key must be URL-encoded
-AIRFLOW_CONN_AWS_DEFAULT=aws://test_key:test_secret@?region_name=us-east-1&host=http://s3:5000
+AIRFLOW_CONN_AWS_DEFAULT=aws://test_key:test_secret@?region_name=us-east-1&endpoint_url=http://s3:5000
# Catalog DB connection. Change the following line in prod to use the appropriate DB
AIRFLOW_CONN_POSTGRES_OPENLEDGER_UPSTREAM=postgres://deploy:deploy@postgres:5432/openledger
diff --git a/justfile b/justfile
index b6468d50a..a8d45c709 100644
--- a/justfile
+++ b/justfile
@@ -11,11 +11,16 @@ DOCKER_FILES := "--file=docker-compose.yml" + (
SERVICE := "webserver"
export PROJECT_PY_VERSION := `grep '# PYTHON' requirements_prod.txt | awk -F= '{print $2}'`
+export PROJECT_AIRFLOW_VERSION := `grep '^apache-airflow' requirements_prod.txt | awk -F= '{print $3}'`
# Print the required Python version
@py-version:
echo $PROJECT_PY_VERSION
+# Print the current Airflow version
+@airflow-version:
+ echo $PROJECT_AIRFLOW_VERSION
+
# Check the installed Python version matches the required Python version and fail if not
check-py-version:
#! /usr/bin/env sh
diff --git a/openverse_catalog/dags/commoncrawl/commoncrawl_etl.py b/openverse_catalog/dags/commoncrawl/commoncrawl_etl.py
index fdc78e2fb..6c3289569 100644
--- a/openverse_catalog/dags/commoncrawl/commoncrawl_etl.py
+++ b/openverse_catalog/dags/commoncrawl/commoncrawl_etl.py
@@ -162,7 +162,7 @@ dag = DAG(
"execution_timeout": None,
},
start_date=datetime(1970, 1, 1),
- schedule_interval="0 0 * * 1",
+ schedule="0 0 * * 1",
max_active_tasks=1,
catchup=False,
tags=["commoncrawl"],
diff --git a/openverse_catalog/dags/commoncrawl/sync_commoncrawl_workflow.py b/openverse_catalog/dags/commoncrawl/sync_commoncrawl_workflow.py
index 15aeb45bd..9a493999f 100644
--- a/openverse_catalog/dags/commoncrawl/sync_commoncrawl_workflow.py
+++ b/openverse_catalog/dags/commoncrawl/sync_commoncrawl_workflow.py
@@ -33,7 +33,7 @@ dag = DAG(
"retry_delay": timedelta(days=1),
"execution_timeout": None,
},
- schedule_interval="0 16 15 * *",
+ schedule="0 16 15 * *",
catchup=False,
tags=["commoncrawl"],
)
diff --git a/openverse_catalog/dags/data_refresh/dag_factory.py b/openverse_catalog/dags/data_refresh/dag_factory.py
index b40874af2..ec1d0710a 100644
--- a/openverse_catalog/dags/data_refresh/dag_factory.py
+++ b/openverse_catalog/dags/data_refresh/dag_factory.py
@@ -157,7 +157,7 @@ def create_data_refresh_dag(data_refresh: DataRefresh, external_dag_ids: Sequenc
dag_id=data_refresh.dag_id,
default_args=default_args,
start_date=data_refresh.start_date,
- schedule_interval=data_refresh.schedule_interval,
+ schedule=data_refresh.schedule,
max_active_runs=1,
catchup=False,
doc_md=__doc__,
diff --git a/openverse_catalog/dags/data_refresh/data_refresh_types.py b/openverse_catalog/dags/data_refresh/data_refresh_types.py
index 9cc6563a3..42149fc10 100644
--- a/openverse_catalog/dags/data_refresh/data_refresh_types.py
+++ b/openverse_catalog/dags/data_refresh/data_refresh_types.py
@@ -25,7 +25,7 @@ class DataRefresh:
airflow.dag.DAG __init__ method.
start_date: datetime.datetime giving the
first valid execution_date of the DAG.
- schedule_interval: string giving the schedule on which the DAG
+ schedule: string giving the schedule on which the DAG
should be run. Passed to the
airflow.dag.DAG __init__ method.
data_refresh_timeout: int giving the amount of time in seconds a
@@ -45,7 +45,7 @@ class DataRefresh:
dag_id: str = field(init=False)
media_type: str
start_date: datetime = datetime(2020, 1, 1)
- schedule_interval: Optional[str] = "@weekly"
+ schedule: Optional[str] = "@weekly"
default_args: Optional[Dict] = field(default_factory=dict)
data_refresh_timeout: int = 24 * 60 * 60 # 1 day
refresh_metrics_timeout: timedelta = timedelta(hours=1)
diff --git a/openverse_catalog/dags/database/image_expiration_workflow.py b/openverse_catalog/dags/database/image_expiration_workflow.py
index a0247fb43..6d6282f21 100644
--- a/openverse_catalog/dags/database/image_expiration_workflow.py
+++ b/openverse_catalog/dags/database/image_expiration_workflow.py
@@ -24,7 +24,7 @@ dag = DAG(
max_active_tasks=MAX_ACTIVE_TASKS,
max_active_runs=MAX_ACTIVE_TASKS,
catchup=False,
- schedule_interval=None,
+ schedule=None,
tags=["database"],
)
diff --git a/openverse_catalog/dags/database/loader_workflow.py b/openverse_catalog/dags/database/loader_workflow.py
index 4ba637200..059cd7872 100644
--- a/openverse_catalog/dags/database/loader_workflow.py
+++ b/openverse_catalog/dags/database/loader_workflow.py
@@ -75,7 +75,7 @@ dag = DAG(
},
max_active_tasks=MAX_ACTIVE_TASKS,
max_active_runs=1,
- schedule_interval=None,
+ schedule=None,
catchup=False,
tags=["database"],
doc_md=__doc__,
diff --git a/openverse_catalog/dags/database/recreate_popularity_calculation_dag_factory.py b/openverse_catalog/dags/database/recreate_popularity_calculation_dag_factory.py
index 2db97c493..bae487a47 100644
--- a/openverse_catalog/dags/database/recreate_popularity_calculation_dag_factory.py
+++ b/openverse_catalog/dags/database/recreate_popularity_calculation_dag_factory.py
@@ -26,7 +26,7 @@ def create_recreate_popularity_calculation_dag(data_refresh: DataRefresh):
dag_id=f"recreate_{media_type}_popularity_calculation",
default_args=default_args,
max_active_runs=1,
- schedule_interval=None,
+ schedule=None,
catchup=False,
doc_md=__doc__,
tags=["database", "data_refresh"],
diff --git a/openverse_catalog/dags/database/report_pending_reported_media.py b/openverse_catalog/dags/database/report_pending_reported_media.py
index d0fbbf842..b55ff8b87 100644
--- a/openverse_catalog/dags/database/report_pending_reported_media.py
+++ b/openverse_catalog/dags/database/report_pending_reported_media.py
@@ -134,7 +134,7 @@ def create_dag():
dag = DAG(
dag_id=DAG_ID,
default_args=DAG_DEFAULT_ARGS,
- schedule_interval="@weekly",
+ schedule="@weekly",
catchup=False,
tags=["database"],
doc_md=__doc__,
diff --git a/openverse_catalog/dags/maintenance/airflow_log_cleanup_workflow.py b/openverse_catalog/dags/maintenance/airflow_log_cleanup_workflow.py
index 063e22804..0ef39bbbc 100644
--- a/openverse_catalog/dags/maintenance/airflow_log_cleanup_workflow.py
+++ b/openverse_catalog/dags/maintenance/airflow_log_cleanup_workflow.py
@@ -45,7 +45,7 @@ dag = DAG(
"template_undefined": jinja2.Undefined,
},
start_date=datetime(2020, 6, 15),
- schedule_interval="@weekly",
+ schedule="@weekly",
max_active_tasks=MAX_ACTIVE_TASKS,
max_active_runs=MAX_ACTIVE_TASKS,
# If this was True, airflow would run this DAG in the beginning
diff --git a/openverse_catalog/dags/maintenance/check_silenced_dags.py b/openverse_catalog/dags/maintenance/check_silenced_dags.py
index e9bd749b0..60fab330a 100644
--- a/openverse_catalog/dags/maintenance/check_silenced_dags.py
+++ b/openverse_catalog/dags/maintenance/check_silenced_dags.py
@@ -99,7 +99,7 @@ dag = DAG(
"retry_delay": timedelta(minutes=1),
},
start_date=datetime(2022, 7, 29),
- schedule_interval="@weekly",
+ schedule="@weekly",
max_active_tasks=MAX_ACTIVE,
max_active_runs=MAX_ACTIVE,
catchup=False,
diff --git a/openverse_catalog/dags/maintenance/pr_review_reminders/pr_review_reminders_dag.py b/openverse_catalog/dags/maintenance/pr_review_reminders/pr_review_reminders_dag.py
index 1a98f3aac..fd1e951ea 100644
--- a/openverse_catalog/dags/maintenance/pr_review_reminders/pr_review_reminders_dag.py
+++ b/openverse_catalog/dags/maintenance/pr_review_reminders/pr_review_reminders_dag.py
@@ -41,7 +41,7 @@ dag = DAG(
},
start_date=datetime(2022, 6, 9),
# Run every weekday
- schedule_interval="0 0 * * 1-5",
+ schedule="0 0 * * 1-5",
max_active_tasks=MAX_ACTIVE_TASKS,
max_active_runs=MAX_ACTIVE_TASKS,
# If this was True, airflow would run this DAG in the beginning
diff --git a/openverse_catalog/dags/oauth2/authorize_dag.py b/openverse_catalog/dags/oauth2/authorize_dag.py
index 9cf2f5f88..2bd5a43b3 100644
--- a/openverse_catalog/dags/oauth2/authorize_dag.py
+++ b/openverse_catalog/dags/oauth2/authorize_dag.py
@@ -16,7 +16,7 @@ from common.constants import DAG_DEFAULT_ARGS
dag = DAG(
dag_id="oauth2_authorization",
- schedule_interval=None,
+ schedule=None,
start_date=datetime(2021, 1, 1),
description="Authorization workflow for all Oauth2 providers.",
max_active_runs=1,
diff --git a/openverse_catalog/dags/oauth2/token_refresh_dag.py b/openverse_catalog/dags/oauth2/token_refresh_dag.py
index 1bcd56124..f4459a6fa 100644
--- a/openverse_catalog/dags/oauth2/token_refresh_dag.py
+++ b/openverse_catalog/dags/oauth2/token_refresh_dag.py
@@ -15,7 +15,7 @@ from common.constants import DAG_DEFAULT_ARGS
dag = DAG(
dag_id="oauth2_token_refresh",
- schedule_interval="0 */12 * * *",
+ schedule="0 */12 * * *",
start_date=datetime(2021, 1, 1),
description="Refresh tokens for all Oauth2 providers",
max_active_runs=1,
diff --git a/openverse_catalog/dags/providers/factory_utils.py b/openverse_catalog/dags/providers/factory_utils.py
index f717926dd..3fa36f408 100644
--- a/openverse_catalog/dags/providers/factory_utils.py
+++ b/openverse_catalog/dags/providers/factory_utils.py
@@ -147,7 +147,7 @@ def pull_media_wrapper(
def date_partition_for_prefix(
- schedule_interval: str | None,
+ schedule: str | None,
logical_date: datetime,
reingestion_date: datetime,
) -> str:
@@ -178,11 +178,11 @@ def date_partition_for_prefix(
prefix = f"year={logical_date.year}"
# Add month in daily/hourly cases
- if schedule_interval in {hourly_airflow, hourly_cron, daily_airflow, daily_cron}:
+ if schedule in {hourly_airflow, hourly_cron, daily_airflow, daily_cron}:
prefix += f"/month={logical_date.month:02}"
# Add day to hourly cases
- if schedule_interval in {hourly_airflow, hourly_cron}:
+ if schedule in {hourly_airflow, hourly_cron}:
prefix += f"/day={logical_date.day:02}"
# Further partition by reingestion date if supplied
diff --git a/openverse_catalog/dags/providers/provider_dag_factory.py b/openverse_catalog/dags/providers/provider_dag_factory.py
index b3edf6f51..79797e41f 100644
--- a/openverse_catalog/dags/providers/provider_dag_factory.py
+++ b/openverse_catalog/dags/providers/provider_dag_factory.py
@@ -288,7 +288,7 @@ def create_provider_api_workflow_dag(conf: ProviderWorkflow):
max_active_tasks=conf.max_active_tasks,
max_active_runs=conf.max_active_runs,
start_date=conf.start_date,
- schedule_interval=conf.schedule_string,
+ schedule=conf.schedule_string,
catchup=conf.dated, # catchup is turned on for dated DAGs to allow backfilling
doc_md=conf.doc_md,
tags=["provider"]
@@ -418,7 +418,7 @@ def create_day_partitioned_reingestion_dag(
max_active_tasks=conf.max_active_tasks,
max_active_runs=conf.max_active_runs,
dagrun_timeout=conf.dagrun_timeout,
- schedule_interval=conf.schedule_string,
+ schedule=conf.schedule_string,
start_date=conf.start_date,
catchup=False,
doc_md=conf.doc_md,
diff --git a/pytest.ini b/pytest.ini
index 7d8e9e8ee..bf9d961c3 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -17,3 +17,21 @@ addopts =
--dist loadscope
--disable-socket
--allow-unix-socket
+# SMTP
+# This occurs because the default config is loaded when running `just test --extended`
+# which happens to still have SMTP credential defaults assigned in it. We do not set
+# these anywhere in the dev stack so it can be safely ignored.
+# Subdag
+# This appears to be coming from Airflow internals during testing as a result of
+# loading the example DAGs:
+# /usr/local/airflow/.local/lib/python3.10/site-packages/airflow/example_dags/example_subdag_operator.py:43: RemovedInAirflow3Warning
+# distutils
+# Warning in dependency, nothing we can do
+# flask
+# Warning in dependency, nothing we can do
+# "removed"/"remoevd" is due to https://github.com/pallets/flask/pull/4757
+filterwarnings=
+ ignore:Fetching SMTP credentials from configuration variables will be deprecated in a future release. Please set credentials using a connection instead:airflow.exceptions.RemovedInAirflow3Warning
+ ignore:This class is deprecated. Please use `airflow.utils.task_group.TaskGroup`.:airflow.exceptions.RemovedInAirflow3Warning
+ ignore:distutils Version classes are deprecated. Use packaging.version instead:DeprecationWarning
+ ignore:.*is deprecated and will be (remoevd|removed) in Flask 2.3.:DeprecationWarning
diff --git a/requirements_prod.txt b/requirements_prod.txt
index 3aec4d73f..45a89546f 100644
--- a/requirements_prod.txt
+++ b/requirements_prod.txt
@@ -1,5 +1,5 @@
# PYTHON=3.10
-apache-airflow[amazon,postgres,http]==2.3.4
+apache-airflow[amazon,postgres,http]==2.4.0
lxml
psycopg2-binary
requests-file==1.5.1
diff --git a/tests/dags/common/operators/test_postgres_result.py b/tests/dags/common/operators/test_postgres_result.py
index 4e11bc350..79bf79c93 100644
--- a/tests/dags/common/operators/test_postgres_result.py
+++ b/tests/dags/common/operators/test_postgres_result.py
@@ -35,7 +35,7 @@ def clean_db():
def get_dag(sql, handler):
with DAG(
dag_id=TEST_DAG_ID,
- schedule_interval="@daily",
+ schedule="@daily",
start_date=DATA_INTERVAL_START,
) as dag:
PostgresResultOperator(
diff --git a/tests/dags/common/sensors/test_single_run_external_dags_sensor.py b/tests/dags/common/sensors/test_single_run_external_dags_sensor.py
index fd8969594..f1d801f1c 100644
--- a/tests/dags/common/sensors/test_single_run_external_dags_sensor.py
+++ b/tests/dags/common/sensors/test_single_run_external_dags_sensor.py
@@ -1,6 +1,5 @@
import logging
import unittest
-import warnings
import pytest
from airflow.exceptions import AirflowException
@@ -106,14 +105,7 @@ class TestExternalDAGsSensor(unittest.TestCase):
def test_fails_if_external_dag_missing_sensor_task(self):
# Loads an example DAG which does not have a Sensor task.
- with warnings.catch_warnings():
- # TODO: As of 2.2.4, initializing the example DAGs emits deprecation
- # TODO: warnings for...(drumroll) Airflow operators 🙃 hopefully this is
- # TODO: fixed in 2.2.5 or something.
- # TODO: Update: 2022-05-06/v2.3.0, still an issue!
- # TODO: Update: 2022-09-19/v2.3.4, Still an issue (MJSB)
- warnings.simplefilter("ignore", category=DeprecationWarning)
- dagbag = DagBag(dag_folder=DEV_NULL, include_examples=True)
+ dagbag = DagBag(dag_folder=DEV_NULL, include_examples=True)
bash_dag = dagbag.dags["example_bash_operator"]
bash_dag.sync_to_db()
diff --git a/tests/dags/providers/test_factory_utils.py b/tests/dags/providers/test_factory_utils.py
index c657dcda1..ff46a6214 100644
--- a/tests/dags/providers/test_factory_utils.py
+++ b/tests/dags/providers/test_factory_utils.py
@@ -247,10 +247,10 @@ def test_pull_media_wrapper_always_pushes_duration(func, ti_mock, dagrun_mock):
assert duration > 0
-# Set up parametrizations for the schedule_interval and reingestion_date,
+# Set up parametrizations for the schedule and reingestion_date,
# which result in different components of the path
@pytest.mark.parametrize(
- "schedule_interval, expected_schedule_prefix",
+ "schedule, expected_schedule_prefix",
[
# Hourly should have year/month/day
("@hourly", "year=2022/month=02/day=03"),
@@ -277,12 +277,12 @@ def test_pull_media_wrapper_always_pushes_duration(func, ti_mock, dagrun_mock):
],
)
def test_date_partition_for_prefix(
- schedule_interval,
+ schedule,
expected_schedule_prefix,
reingestion_date,
expected_reingestion_prefix,
):
actual = factory_utils.date_partition_for_prefix(
- schedule_interval, datetime(2022, 2, 3), reingestion_date
+ schedule, datetime(2022, 2, 3), reingestion_date
)
assert actual == expected_schedule_prefix + expected_reingestion_prefix
diff --git a/tests/utilities/dag_doc_gen/test_dag_doc_generation.py b/tests/utilities/dag_doc_gen/test_dag_doc_generation.py
index 32beb61af..10423edb3 100644
--- a/tests/utilities/dag_doc_gen/test_dag_doc_generation.py
+++ b/tests/utilities/dag_doc_gen/test_dag_doc_generation.py
@@ -8,6 +8,8 @@ from openverse_catalog.utilities.dag_doc_gen.dag_doc_generation import DagInfo
class DagMock(NamedTuple):
+ # schedule_interval used here because the Dag model does not actually have a
+ # schedule attribute
schedule_interval: str | None
doc_md: str | None
catchup: bool
@@ -21,7 +23,7 @@ PROVIDER_WORKFLOW_INSTANCE.media_types = SAMPLE_MEDIA_TYPES
_MODULE = "openverse_catalog.utilities.dag_doc_gen.dag_doc_generation"
[email protected]("schedule_interval", ["@daily", None])
[email protected]("schedule", ["@daily", None])
@pytest.mark.parametrize(
"doc, expected_doc",
[
@@ -42,14 +44,12 @@ _MODULE = "openverse_catalog.utilities.dag_doc_gen.dag_doc_generation"
)
@pytest.mark.parametrize("provider_workflow", ["foo_bar", None])
def test_get_dags_info(
- schedule_interval, doc, expected_doc, catchup, tags, type_, provider_workflow
+ schedule, doc, expected_doc, catchup, tags, type_, provider_workflow
):
- dag = DagMock(
- schedule_interval=schedule_interval, doc_md=doc, catchup=catchup, tags=tags
- )
+ dag = DagMock(schedule_interval=schedule, doc_md=doc, catchup=catchup, tags=tags)
expected = DagInfo(
dag_id=DAG_ID,
- schedule=schedule_interval,
+ schedule=schedule,
doc=expected_doc,
dated=catchup,
type_=type_,