Skip to content

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

Adjust timeouts for image data refresh (#5123)

Staci Mullinsab8a52d9404e
diff --git a/catalog/dags/data_refresh/copy_data.py b/catalog/dags/data_refresh/copy_data.py
index aa2213f49..0bd6a9ee3 100644
--- a/catalog/dags/data_refresh/copy_data.py
+++ b/catalog/dags/data_refresh/copy_data.py
@@ -193,7 +193,8 @@ def copy_upstream_table(
upstream_conn_id: str,
downstream_conn_id: str,
fdw_name: str,
- timeout: timedelta,
+ copy_timeout: timedelta,
+ primary_key_timeout: timedelta,
limit: int,
upstream_table_name: str,
downstream_table_name: str,
@@ -247,7 +248,7 @@ def copy_upstream_table(
temp_table_name=temp_table_name,
)
- copy = copy_data.override(execution_timeout=timeout)(
+ copy = copy_data.override(execution_timeout=copy_timeout)(
postgres_conn_id=downstream_conn_id,
limit=limit,
sql_template=copy_data_query,
@@ -261,6 +262,7 @@ def copy_upstream_table(
add_primary_key = run_sql.override(
task_id="add_primary_key",
map_index_template="{{ task.op_kwargs['temp_table_name'] }}",
+ execution_timeout=primary_key_timeout,
)(
postgres_conn_id=downstream_conn_id,
sql_template=queries.ADD_PRIMARY_KEY_QUERY,
@@ -307,7 +309,8 @@ def copy_upstream_tables(
upstream_conn_id=upstream_conn_id,
downstream_conn_id=downstream_conn_id,
fdw_name=init_fdw,
- timeout=data_refresh_config.copy_data_timeout,
+ copy_timeout=data_refresh_config.copy_data_timeout,
+ primary_key_timeout=data_refresh_config.add_primary_key_timeout,
limit=limit,
).expand_kwargs([asdict(tm) for tm in data_refresh_config.table_mappings])
diff --git a/catalog/dags/data_refresh/data_refresh_types.py b/catalog/dags/data_refresh/data_refresh_types.py
index 87418bd2a..3ff42d032 100644
--- a/catalog/dags/data_refresh/data_refresh_types.py
+++ b/catalog/dags/data_refresh/data_refresh_types.py
@@ -95,6 +95,7 @@ class DataRefreshConfig:
default_args: dict = field(default_factory=dict)
dag_timeout: timedelta = timedelta(days=1)
copy_data_timeout: timedelta = timedelta(hours=1)
+ add_primary_key_timeout: timedelta = timedelta(hours=1)
indexer_worker_timeout: timedelta = timedelta(hours=12)
index_readiness_timeout: timedelta = timedelta(days=1)
create_filtered_index_timeout: timedelta = timedelta(days=1)
@@ -124,6 +125,8 @@ DATA_REFRESH_CONFIGS = {
),
dag_timeout=timedelta(days=4),
copy_data_timeout=timedelta(hours=12),
+ add_primary_key_timeout=timedelta(hours=12),
+ indexer_worker_timeout=timedelta(days=1),
concurrency_check_poke_interval=int(
os.getenv("DATA_REFRESH_POKE_INTERVAL", 60)
),