Skip to content

Commit

Permalink
Flush model origin in ingest_flush to clean before schema changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Apr 14, 2021
1 parent 69d63a6 commit f5f9340
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions aleph/logic/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ftmstore import get_dataset

log = logging.getLogger(__name__)
MODEL_ORIGIN = "model"


def get_aggregator_name(collection):
Expand Down
3 changes: 1 addition & 2 deletions aleph/logic/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
from aleph.index import xref as xref_index
from aleph.index import entities as entities_index
from aleph.logic.notifications import publish, flush_notifications
from aleph.logic.documents import ingest_flush
from aleph.logic.documents import ingest_flush, MODEL_ORIGIN
from aleph.logic.aggregator import get_aggregator

log = logging.getLogger(__name__)
MODEL_ORIGIN = "model"


def create_collection(data, authz, sync=False):
Expand Down
3 changes: 2 additions & 1 deletion aleph/logic/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
from aleph.core import db, archive, settings
from aleph.model import Document
from aleph.queues import ingest_entity
from aleph.logic.aggregator import get_aggregator
from aleph.logic.aggregator import get_aggregator, MODEL_ORIGIN

log = logging.getLogger(__name__)


def ingest_flush(collection, entity_id=None):
"""Clear entity fragments generated by the ingest process."""
aggregator = get_aggregator(collection)
aggregator.delete(entity_id=entity_id, origin=MODEL_ORIGIN)
for stage in settings.INGEST_PIPELINE:
aggregator.delete(entity_id=entity_id, origin=stage)

Expand Down

0 comments on commit f5f9340

Please sign in to comment.