Skip to content

Commit

Permalink
add a flag for disabling delta updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Jul 17, 2024
1 parent 27d84dd commit 243eb7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion yente/data/updater.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Optional, TypedDict, Dict, List, Any
from typing import AsyncGenerator, Tuple

from yente import settings
from yente.logs import get_logger
from yente.data.dataset import Dataset
from yente.data.loader import load_json_url, load_json_lines
Expand Down Expand Up @@ -41,6 +42,8 @@ async def build(
if dataset.delta_url is None:
log.debug("No delta updates available for: %r" % dataset.name)
return obj
if not settings.DELTA_UPDATES:
return obj
if obj.base_version is None or obj.target_version <= obj.base_version:
return obj

Expand Down Expand Up @@ -77,7 +80,9 @@ def is_incremental(self) -> bool:
"""Check if there is sequence of delta entity patches that can be loaded."""
if self.force_full:
return False
return self.delta_urls is not None and len(self.delta_urls) > 0
if not settings.DELTA_UPDATES:
return False
return self.delta_urls is not None

def needs_update(self) -> bool:
"""Confirm that the dataset needs to be loaded."""
Expand Down
1 change: 1 addition & 0 deletions yente/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def random_cron() -> str:
CRONTAB = env_str("YENTE_CRONTAB", random_cron())
AUTO_REINDEX = as_bool(env_str("YENTE_AUTO_REINDEX", "true"))
STREAM_LOAD = as_bool(env_str("YENTE_STREAM_LOAD", "true"))
DELTA_UPDATES = as_bool(env_str("YENTE_DELTA_UPDATES", "true"))
DEFAULT_ALGORITHM = env_str("YENTE_DEFAULT_ALGORITHM", "logic-v1")
BEST_ALGORITHM = env_str("YENTE_BEST_ALGORITHM", "logic-v1")

Expand Down

0 comments on commit 243eb7a

Please sign in to comment.