Skip to content

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

Add dayshift to tsv filenames for reingestion workflows (#969)

Staci Mullins7c5f0a1a942d
diff --git a/openverse_catalog/dags/common/storage/audio.py b/openverse_catalog/dags/common/storage/audio.py
index 6b07dfb27..72d82695f 100644
--- a/openverse_catalog/dags/common/storage/audio.py
+++ b/openverse_catalog/dags/common/storage/audio.py
@@ -17,9 +17,7 @@ class AudioStore(MediaStore):
Optional init arguments:
provider: String marking the provider in the `audio` table of the DB.
- date: Date String in the form YYYY-MM-DD. This is the date for
- which data is being stored. If provided, it will be appended to
- the tsv filename.
+ tsv_suffix: Optional string to append to the tsv filename.
output_file: String giving a temporary .tsv filename (*not* the
full path) where the audio info should be stored.
output_dir: String giving a path where `output_file` should be placed.
@@ -30,13 +28,14 @@ class AudioStore(MediaStore):
def __init__(
self,
provider=None,
+ tsv_suffix=None,
output_file=None,
output_dir=None,
buffer_length=100,
media_type="audio",
tsv_columns=None,
):
- super().__init__(provider, buffer_length, media_type)
+ super().__init__(provider, tsv_suffix, buffer_length, media_type)
self.columns = CURRENT_AUDIO_TSV_COLUMNS if tsv_columns is None else tsv_columns
def add_item(
diff --git a/openverse_catalog/dags/common/storage/image.py b/openverse_catalog/dags/common/storage/image.py
index 4f8e0d02a..df26d4119 100644
--- a/openverse_catalog/dags/common/storage/image.py
+++ b/openverse_catalog/dags/common/storage/image.py
@@ -17,9 +17,7 @@ class ImageStore(MediaStore):
Optional init arguments:
provider: String marking the provider in the `image` table of the DB.
- date: Date String in the form YYYY-MM-DD. This is the date for
- which data is being stored. If provided, it will be appended to
- the tsv filename.
+ tsv_suffix: Optional string to append to the tsv filename.
output_file: String giving a temporary .tsv filename (*not* the
full path) where the image info should be stored.
output_dir: String giving a path where `output_file` should be placed.
@@ -30,13 +28,14 @@ class ImageStore(MediaStore):
def __init__(
self,
provider=None,
+ tsv_suffix=None,
output_file=None,
output_dir=None,
buffer_length=100,
media_type="image",
tsv_columns=None,
):
- super().__init__(provider, buffer_length, media_type)
+ super().__init__(provider, tsv_suffix, buffer_length, media_type)
self.columns = CURRENT_IMAGE_TSV_COLUMNS if tsv_columns is None else tsv_columns
def add_item(
diff --git a/openverse_catalog/dags/common/storage/media.py b/openverse_catalog/dags/common/storage/media.py
index e3eb988da..a0eb6bf3a 100644
--- a/openverse_catalog/dags/common/storage/media.py
+++ b/openverse_catalog/dags/common/storage/media.py
@@ -46,16 +46,16 @@ class MediaStore(metaclass=abc.ABCMeta):
Optional init arguments:
provider: String marking the provider in the `media`
(`image`, `audio` etc) table of the DB.
- date: Date String in the form YYYY-MM-DD. This is the date for
- which data is being stored. If provided, it will be appended to
- the tsv filename.
+ tsv_suffix: Optional string to append to the tsv filename.
buffer_length: Integer giving the maximum number of media information rows
to store in memory before writing them to disk.
+
"""
def __init__(
self,
provider: str | None = None,
+ tsv_suffix: str | None = None,
buffer_length: int = 100,
media_type: str | None = "generic",
):
@@ -63,7 +63,7 @@ class MediaStore(metaclass=abc.ABCMeta):
self.media_type = media_type
self.provider = provider
self.buffer_length = buffer_length
- self.output_path = self._initialize_output_path(provider)
+ self.output_path = self._initialize_output_path(provider, tsv_suffix=tsv_suffix)
self.columns = None
self._media_buffer = []
self._total_items = 0
@@ -150,6 +150,7 @@ class MediaStore(metaclass=abc.ABCMeta):
def _initialize_output_path(
self,
provider: str | None,
+ tsv_suffix: str | None = None,
version: str | None = None,
) -> str:
"""
@@ -169,11 +170,16 @@ class MediaStore(metaclass=abc.ABCMeta):
"OUTPUT_DIR is not set in the environment. Output will go to /tmp."
)
output_dir = "/tmp"
- if version is None:
- version = CURRENT_VERSION[self.media_type]
-
- datetime_string = datetime.now().strftime("%Y%m%d%H%M%S")
- output_file = f"{provider}_{self.media_type}_v{version}_{datetime_string}.tsv"
+ version = f"v{version or CURRENT_VERSION[self.media_type]}"
+
+ path_components = [
+ provider,
+ self.media_type,
+ version,
+ datetime.now().strftime("%Y%m%d%H%M%S"),
+ tsv_suffix,
+ ]
+ output_file = ("_").join(filter(None, path_components)) + ".tsv"
output_path = os.path.join(output_dir, output_file)
logger.info(f"Output path: {output_path}")
diff --git a/openverse_catalog/dags/providers/factory_utils.py b/openverse_catalog/dags/providers/factory_utils.py
index eae820c66..ca66e51ef 100644
--- a/openverse_catalog/dags/providers/factory_utils.py
+++ b/openverse_catalog/dags/providers/factory_utils.py
@@ -6,84 +6,45 @@ from datetime import datetime
from airflow.models import DagRun, TaskInstance
from airflow.utils.dates import cron_presets
from common.constants import MediaType
+from common.storage.media import MediaStore
from providers.provider_api_scripts.provider_data_ingester import ProviderDataIngester
logger = logging.getLogger(__name__)
-def generate_tsv_filenames(
- ingester_class: type[ProviderDataIngester],
- media_types: list[MediaType],
- ti: TaskInstance,
- dag_run: DagRun,
- args: Sequence = None,
-) -> None:
- """
- Calculate the output directories for each media store to XComs. Output locations
- are pushed under keys with the format `<media-type>_tsv`. This is a temporary
- workaround due to the nature of the current provider scripts. Once
- https://github.com/WordPress/openverse-catalog/issues/229 is addressed and the
- provider scripts are refactored into classes, we can alter the process by which
- MediaStores create/set their output directory so that they are always expected
- to receive it.
- """
- args = args or []
- logger.info("Pushing available store paths to XComs")
-
- # Initialize the ProviderDataIngester class, which will initialize the
- # DelayedRequester and appropriate media stores.
- logger.info(
- f"Initializing ProviderIngester {ingester_class.__name__} in"
- f"order to generate store filenames."
- )
- ingester = ingester_class(dag_run.conf, dag_run.dag_id, *args)
- stores = ingester.media_stores
-
- # Push the media store output paths to XComs.
- for store in stores.values():
- logger.info(
- f"{store.media_type.capitalize()} store location: {store.output_path}"
- )
- ti.xcom_push(key=f"{store.media_type}_tsv", value=store.output_path)
-
-
def pull_media_wrapper(
ingester_class: type[ProviderDataIngester],
media_types: list[MediaType],
- tsv_filenames: list[str],
ti: TaskInstance,
dag_run: DagRun,
args: Sequence = None,
):
"""
- Run the provided callable after pushing setting the output directories
- for each media store using the provided values. This is a temporary workaround
- due to the nature of the current provider scripts. Once
- https://github.com/WordPress/openverse-catalog/issues/229 is addressed and the
- provider scripts are refactored into classes, this wrapper can either be updated
- or the output filename retrieval/setting process can be altered.
+ Run the provided callable after pushing the output directories for each media
+ store, which are generated when initializing the ingester class.
"""
args = args or []
- if len(media_types) != len(tsv_filenames):
- raise ValueError(
- "Provided media types and TSV filenames don't match: "
- f"{media_types=} {tsv_filenames=}"
- )
- logger.info("Setting media stores to the appropriate output filenames")
-
# Initialize the ProviderDataIngester class, which will initialize the
# media stores and DelayedRequester.
logger.info(f"Initializing ProviderIngester {ingester_class.__name__}")
ingester = ingester_class(dag_run.conf, dag_run.dag_id, *args)
- stores = ingester.media_stores
+ stores: dict[MediaType, MediaStore] = ingester.media_stores
- for store, tsv_filename in zip(stores.values(), tsv_filenames):
+ # Check that the ProviderDataIngester class has a store configuration for each
+ # of the given media types.
+ if len(media_types) != len(stores):
+ raise ValueError(
+ "Provided media types and media stores don't match: "
+ f"{media_types=} stores={list(stores.keys())}"
+ )
+
+ # Push the media store output paths to XComs.
+ for store in stores.values():
logger.info(
- f"Setting {store.media_type.capitalize()} store location "
- f"to {tsv_filename}"
+ f"{store.media_type.capitalize()} store location: {store.output_path}"
)
- store.output_path = tsv_filename
+ ti.xcom_push(key=f"{store.media_type}_tsv", value=store.output_path)
logger.info("Beginning ingestion")
start_time = time.perf_counter()
diff --git a/openverse_catalog/dags/providers/provider_api_scripts/metropolitan_museum.py b/openverse_catalog/dags/providers/provider_api_scripts/metropolitan_museum.py
index 8981a7571..7b848e82e 100644
--- a/openverse_catalog/dags/providers/provider_api_scripts/metropolitan_museum.py
+++ b/openverse_catalog/dags/providers/provider_api_scripts/metropolitan_museum.py
@@ -44,7 +44,6 @@ class MetMuseumDataIngester(ProviderDataIngester):
endpoint = "https://collectionapi.metmuseum.org/public/collection/v1/objects"
DEFAULT_LICENSE_INFO = get_license_info(license_="cc0", license_version="1.0")
- # adding args for automatically generated parameters from generate_tsv_filenames
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.retries = 5
diff --git a/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py b/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
index 48e615cd1..c75a2e7c5 100644
--- a/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
+++ b/openverse_catalog/dags/providers/provider_api_scripts/provider_data_ingester.py
@@ -97,7 +97,13 @@ class ProviderDataIngester(ABC):
"""The URL with which to request records from the API."""
pass
- def __init__(self, conf: dict = None, dag_id: str = None, date: str = None):
+ def __init__(
+ self,
+ conf: dict = None,
+ dag_id: str = None,
+ date: str = None,
+ day_shift: int = None,
+ ):
"""
Initialize the provider configuration.
Optional Arguments:
@@ -127,7 +133,7 @@ class ProviderDataIngester(ABC):
self.delayed_requester = DelayedRequester(
delay=self.delay, headers=self.headers
)
- self.media_stores = self._init_media_stores()
+ self.media_stores = self._init_media_stores(day_shift)
self.date = date
self.dag_id = dag_id or ""
@@ -155,13 +161,15 @@ class ProviderDataIngester(ABC):
# Create a generator to facilitate fetching the next set of query_params.
self.override_query_params = (qp for qp in query_params_list)
- def _init_media_stores(self) -> dict[str, MediaStore]:
+ def _init_media_stores(self, day_shift: int = None) -> dict[str, MediaStore]:
"""Initialize a media store for each media type supported by this provider."""
+
media_stores = {}
+ tsv_suffix = str(day_shift) if day_shift else None
for media_type, provider in self.providers.items():
StoreClass = get_media_store_class(media_type)
- media_stores[media_type] = StoreClass(provider)
+ media_stores[media_type] = StoreClass(provider, tsv_suffix=tsv_suffix)
return media_stores
diff --git a/openverse_catalog/dags/providers/provider_dag_factory.py b/openverse_catalog/dags/providers/provider_dag_factory.py
index 1c27fce34..c4602233a 100644
--- a/openverse_catalog/dags/providers/provider_dag_factory.py
+++ b/openverse_catalog/dags/providers/provider_dag_factory.py
@@ -74,11 +74,7 @@ from airflow.utils.task_group import TaskGroup
from airflow.utils.trigger_rule import TriggerRule
from common.constants import DAG_DEFAULT_ARGS, XCOM_PULL_TEMPLATE
from common.loader import loader, reporting, s3, sql
-from providers.factory_utils import (
- date_partition_for_prefix,
- generate_tsv_filenames,
- pull_media_wrapper,
-)
+from providers.factory_utils import date_partition_for_prefix, pull_media_wrapper
from providers.provider_reingestion_workflows import ProviderReingestionWorkflow
from providers.provider_workflows import ProviderWorkflow
@@ -131,26 +127,16 @@ def create_ingestion_workflow(
"media_types": conf.media_types,
}
if conf.dated:
- ingestion_kwargs["args"] = [DATE_RANGE_ARG_TEMPLATE.format(day_shift)]
-
- generate_filenames = PythonOperator(
- task_id=append_day_shift(f"generate_{media_type_name}_filename"),
- python_callable=generate_tsv_filenames,
- op_kwargs=ingestion_kwargs,
- )
+ ingestion_kwargs["args"] = [
+ DATE_RANGE_ARG_TEMPLATE.format(day_shift),
+ day_shift, # Pass day_shift in as the tsv_suffix
+ ]
pull_data = PythonOperator(
task_id=append_day_shift(f"pull_{media_type_name}_data"),
python_callable=pull_media_wrapper,
op_kwargs={
**ingestion_kwargs,
- # Note: this is assumed to match the order of media_types exactly
- "tsv_filenames": [
- XCOM_PULL_TEMPLATE.format(
- generate_filenames.task_id, f"{media_type}_tsv"
- )
- for media_type in conf.media_types
- ],
},
depends_on_past=False,
execution_timeout=conf.pull_timeout,
@@ -182,7 +168,7 @@ def create_ingestion_workflow(
python_callable=s3.copy_file_to_s3,
op_kwargs={
"tsv_file_path": XCOM_PULL_TEMPLATE.format(
- generate_filenames.task_id, f"{media_type}_tsv"
+ pull_data.task_id, f"{media_type}_tsv"
),
"s3_bucket": OPENVERSE_BUCKET,
"s3_prefix": DATE_PARTITION_ARG_TEMPLATE.substitute(
@@ -260,7 +246,7 @@ def create_ingestion_workflow(
)
load_tasks.append(load_data)
- generate_filenames >> pull_data >> load_tasks
+ pull_data >> load_tasks
if conf.create_preingestion_tasks:
preingestion_tasks = conf.create_preingestion_tasks()
diff --git a/tests/dags/common/storage/test_media.py b/tests/dags/common/storage/test_media.py
index c4eed2e5f..6cf10367b 100644
--- a/tests/dags/common/storage/test_media.py
+++ b/tests/dags/common/storage/test_media.py
@@ -98,6 +98,12 @@ def test_MediaStore_includes_media_type_in_output_file_string():
assert "image" in image_store.output_path
+def test_MediaStore_includes_tsvsuffix_if_provided():
+ image_store = image.ImageStore("test_provider", tsv_suffix="foo")
+ assert type(image_store.output_path) == str
+ assert image_store.output_path.endswith("_foo.tsv")
+
+
def test_MediaStore_add_item_flushes_buffer(tmpdir):
image_store = image.ImageStore(
provider="testing_provider",
diff --git a/tests/dags/providers/provider_api_scripts/test_provider_data_ingester.py b/tests/dags/providers/provider_api_scripts/test_provider_data_ingester.py
index 44aaf1227..ab3b98c5b 100644
--- a/tests/dags/providers/provider_api_scripts/test_provider_data_ingester.py
+++ b/tests/dags/providers/provider_api_scripts/test_provider_data_ingester.py
@@ -44,12 +44,33 @@ def _get_resource_json(json_name):
def test_init_media_stores():
- ingester = MockProviderDataIngester()
+ with patch(
+ "common.storage.media.MediaStore._initialize_output_path"
+ ) as get_path_mock:
+ ingester = MockProviderDataIngester()
+
+ # We should have two media stores, with the correct types
+ stores = ingester.media_stores
+ assert len(stores) == 2
+ assert isinstance(stores["audio"], AudioStore)
+ assert isinstance(stores["image"], ImageStore)
+
+ # The ingester was not initialized with a day_shift, so no
+ # suffix should be applied to the tsv filenames.
+ expected_calls = [
+ call("mock_audio_provider", tsv_suffix=None),
+ call("mock_image_provider", tsv_suffix=None),
+ ]
+ get_path_mock.assert_has_calls(expected_calls)
+
- # We should have two media stores, with the correct types
- assert len(ingester.media_stores) == 2
- assert isinstance(ingester.media_stores["audio"], AudioStore)
- assert isinstance(ingester.media_stores["image"], ImageStore)
+def test_init_media_stores_with_day_shift():
+ ingester = MockProviderDataIngester(day_shift=5)
+ # The day shift should have been appended to all generated tsv filenames
+ stores = ingester.media_stores
+ assert len(stores) == 2
+ for store in stores.values():
+ assert store.output_path.endswith("_5.tsv")
def test_init_with_date():
diff --git a/tests/dags/providers/test_factory_utils.py b/tests/dags/providers/test_factory_utils.py
index 754dd6a41..1a0201059 100644
--- a/tests/dags/providers/test_factory_utils.py
+++ b/tests/dags/providers/test_factory_utils.py
@@ -54,66 +54,54 @@ FakeDataIngesterClass.__name__ = "FakeDataIngesterClass"
FakeDataIngesterClass.side_effect = _set_up_ingester
- "func, media_types, stores",
- [
- # Happy path
- (FakeDataIngesterClass, ["image", "audio"], list(fdi.media_stores.values())),
- # No media types provided, ingester class still supplies stores
- (FakeDataIngesterClass, 2, list(fdi.media_stores.values())),
- ],
-)
-def test_generate_tsv_filenames(
- func, media_types, stores, ti_mock, dagrun_mock, internal_func_mock
-):
- value = 42
- factory_utils.generate_tsv_filenames(
- func,
- media_types,
- ti_mock,
- dagrun_mock,
- args=[internal_func_mock, value],
- )
- # There should be one call to xcom_push for each provided store
- # If the media_types value is an int, use that for the expected xcoms test
- expected_xcoms = len(media_types) if isinstance(media_types, list) else media_types
- actual_xcoms = ti_mock.xcom_push.call_count
- assert (
- actual_xcoms == expected_xcoms
- ), f"Expected {expected_xcoms} XComs but {actual_xcoms} pushed"
- for args, store in zip(ti_mock.xcom_push.mock_calls[:-1], stores):
- assert args.kwargs["value"] == store.output_path
-
- # Check that the function itself was NOT called with the provided args
- internal_func_mock.assert_not_called()
-
-
def test_pull_media_wrapper(ti_mock, dagrun_mock, internal_func_mock):
value = 42
- stores = list(fdi.media_stores.values())
- tsv_filenames = ["image_file_000.tsv", "audio_file_111.tsv"]
factory_utils.pull_media_wrapper(
FakeDataIngesterClass,
["image", "audio"],
- tsv_filenames,
ti_mock,
dagrun_mock,
args=[internal_func_mock, value],
)
- # We should have one XCom push for duration
- assert ti_mock.xcom_push.call_count == 1
+ # We should have one XCom push for duration, and two for the tsv filenames
+ assert ti_mock.xcom_push.call_count == 3
+ push_calls = ti_mock.xcom_push.mock_calls
+ # Check that the tsv filenames were reported
+ assert push_calls[0].kwargs["key"] == "image_tsv"
+ assert push_calls[1].kwargs["key"] == "audio_tsv"
# Check that the duration was reported
- assert ti_mock.xcom_push.mock_calls[0].kwargs["key"] == "duration"
- # Check that the output paths for the stores were changed to the provided filenames
- for filename, store in zip(tsv_filenames, stores):
- assert store.output_path == filename
+ assert push_calls[2].kwargs["key"] == "duration"
# Check that the function itself was called with the provided args
internal_func_mock.assert_called_once_with(value)
+def test_pull_media_wrapper_checks_media_types(ti_mock, dagrun_mock):
+ value = 42
+ # The FakeDataIngester class has stores for `audio` and `image`. Calling
+ # `pull_media_wrapper` with only `image` will raise an error due to the
+ # mismatch in media types.
+ error_message = (
+ "Provided media types and media stores don't match: "
+ r"media_types=\['image'\] stores=\['image', 'audio'\]"
+ )
+ with pytest.raises(ValueError, match=error_message):
+ factory_utils.pull_media_wrapper(
+ FakeDataIngesterClass,
+ ["image"], # Only pass in `image` for media_types
+ ti_mock,
+ dagrun_mock,
+ args=[internal_func_mock, value],
+ )
+
+ # We should fail early with no XCom pushes
+ assert ti_mock.xcom_push.call_count == 0
+
+
def test_pull_media_wrapper_always_pushes_duration(ti_mock, dagrun_mock):
+ # Force `ingest_records` to throw an error, and verify that duration
+ # is still reported to XComs.
error_message = "Whoops!"
def _raise_an_error(text):
@@ -122,19 +110,21 @@ def test_pull_media_wrapper_always_pushes_duration(ti_mock, dagrun_mock):
with pytest.raises(ValueError, match=error_message):
factory_utils.pull_media_wrapper(
FakeDataIngesterClass,
- ["image"],
- ["file1.tsv"],
+ ["image", "audio"],
ti_mock,
dagrun_mock,
args=[_raise_an_error, error_message],
)
- # We should have one XCom push for duration
- assert ti_mock.xcom_push.call_count == 1
- push_call = ti_mock.xcom_push.mock_calls[0]
+ # We should have one XCom push for duration, and two for the tsv filenames
+ assert ti_mock.xcom_push.call_count == 3
+ push_calls = ti_mock.xcom_push.mock_calls
+ # Check that the tsv was reported for each media type
+ assert push_calls[0].kwargs["key"] == "image_tsv"
+ assert push_calls[1].kwargs["key"] == "audio_tsv"
# Check that the duration was reported
- assert push_call.kwargs["key"] == "duration"
- # Check that it was *not* None (it should always be recorded)
- duration = push_call.kwargs["value"]
+ assert push_calls[2].kwargs["key"] == "duration"
+ # Check that duration was *not* None (it should always be recorded)
+ duration = push_calls[2].kwargs["value"]
assert duration is not None
assert duration > 0
diff --git a/tests/dags/providers/test_provider_dag_factory.py b/tests/dags/providers/test_provider_dag_factory.py
index 1292fc0b2..adeffcda3 100644
--- a/tests/dags/providers/test_provider_dag_factory.py
+++ b/tests/dags/providers/test_provider_dag_factory.py
@@ -34,13 +34,6 @@ def clean_db():
_clean_dag_from_db()
-def _generate_tsv_mock(ingester_class, media_types, ti, **kwargs):
- for media_type in media_types:
- ti.xcom_push(
- key=f"{media_type}_tsv", value=f"/tmp/{media_type}_does_not_exist.tsv"
- )
-
-
@mark_extended
@pytest.mark.parametrize(
"side_effect",
@@ -58,12 +51,9 @@ def _generate_tsv_mock(ingester_class, media_types, ti, **kwargs):
)
def test_skipped_pull_data_runs_successfully(side_effect, clean_db):
with mock.patch(
- "providers.provider_dag_factory.generate_tsv_filenames"
- ) as generate_filenames_mock, mock.patch(
- "providers.provider_dag_factory.pull_media_wrapper"
- ) as pull_media_mock:
- generate_filenames_mock.side_effect = _generate_tsv_mock
- pull_media_mock.side_effect = side_effect
+ "tests.dags.providers.provider_api_scripts.resources.provider_data_ingester.mock_provider_data_ingester.MockProviderDataIngester.ingest_records"
+ ) as ingest_records_mock:
+ ingest_records_mock.side_effect = side_effect
dag = provider_dag_factory.create_provider_api_workflow_dag(
ProviderWorkflow(
ingester_class=MockProviderDataIngester,
@@ -83,12 +73,12 @@ def test_create_day_partitioned_ingestion_dag_with_single_layer_dependencies():
[[1, 2]],
)
# First task in the ingestion step for today
- today_pull_data_id = "ingest_data.generate_image_filename"
+ today_pull_data_id = "ingest_data.pull_image_data"
# Last task in the ingestion step for today
today_drop_table_id = "ingest_data.load_image_data.drop_loading_table"
gather0_id = "gather_partition_0"
- ingest1_id = "ingest_data_day_shift_1.generate_image_filename_day_shift_1"
- ingest2_id = "ingest_data_day_shift_2.generate_image_filename_day_shift_2"
+ ingest1_id = "ingest_data_day_shift_1.pull_image_data_day_shift_1"
+ ingest2_id = "ingest_data_day_shift_2.pull_image_data_day_shift_2"
today_pull_task = dag.get_task(today_pull_data_id)
assert today_pull_task.upstream_task_ids == set()
gather_task = dag.get_task(gather0_id)
@@ -106,14 +96,14 @@ def test_create_day_partitioned_ingestion_dag_with_multi_layer_dependencies():
),
[[1, 2], [3, 4, 5]],
)
- today_id = "ingest_data.generate_audio_filename"
+ today_id = "ingest_data.pull_audio_data"
gather0_id = "gather_partition_0"
- ingest1_id = "ingest_data_day_shift_1.generate_audio_filename_day_shift_1"
- ingest2_id = "ingest_data_day_shift_2.generate_audio_filename_day_shift_2"
+ ingest1_id = "ingest_data_day_shift_1.pull_audio_data_day_shift_1"
+ ingest2_id = "ingest_data_day_shift_2.pull_audio_data_day_shift_2"
gather1_id = "gather_partition_1"
- ingest3_id = "ingest_data_day_shift_3.generate_audio_filename_day_shift_3"
- ingest4_id = "ingest_data_day_shift_4.generate_audio_filename_day_shift_4"
- ingest5_id = "ingest_data_day_shift_5.generate_audio_filename_day_shift_5"
+ ingest3_id = "ingest_data_day_shift_3.pull_audio_data_day_shift_3"
+ ingest4_id = "ingest_data_day_shift_4.pull_audio_data_day_shift_4"
+ ingest5_id = "ingest_data_day_shift_5.pull_audio_data_day_shift_5"
today_task = dag.get_task(today_id)
assert today_task.upstream_task_ids == set()
ingest1_task = dag.get_task(ingest1_id)