Skip to content

Commit

Permalink
Add index check to filtered index
Browse files Browse the repository at this point in the history
  • Loading branch information
stacimc committed Jun 20, 2023
1 parent 288e069 commit 8ee2719
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion catalog/dags/common/ingestion_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def trigger_and_wait_for_task(
def index_readiness_check(
media_type: str,
index_suffix: str,
timeout: timedelta,
timeout: timedelta = timedelta(days=1),
poke_interval: int = POKE_INTERVAL,
) -> HttpSensor:
"""
Expand Down
8 changes: 7 additions & 1 deletion catalog/dags/data_refresh/create_filtered_index_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ def point_alias(destination_index_suffix: str):
destination_index_suffix=destination_index_suffix,
)

# Await healthy results from the newly created elasticsearch index.
index_readiness_check = ingestion_server.index_readiness_check(
media_type=media_type,
index_suffix=destination_index_suffix,
)

do_point_alias = point_alias(destination_index_suffix=destination_index_suffix)

delete_old_index = ingestion_server.trigger_task(
Expand Down Expand Up @@ -235,7 +241,7 @@ def point_alias(destination_index_suffix: str):
)

get_current_index_if_exists >> continue_if_no_current_index >> do_create
await_create >> do_point_alias
await_create >> index_readiness_check >> do_point_alias

[get_current_index_if_exists, do_point_alias] >> delete_old_index

Expand Down
2 changes: 1 addition & 1 deletion catalog/dags/data_refresh/data_refresh_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DataRefresh:
create_materialized_view_timeout: timedelta expressing amount of time the
creation of the matview may take
index_readiness_timeout: timedelta expressing amount of time it may take
to await a healthy ES cluster after reindexing
to await a healthy ES index after reindexing
doc_md: str used for the DAG's documentation markdown
"""

Expand Down

0 comments on commit 8ee2719

Please sign in to comment.