Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM python:3.11-bullseye AS base
WORKDIR /project
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
RUN python -m spacy download en_core_web_sm

FROM base AS test
RUN chmod +x docker-entrypoint.sh
Expand Down
5 changes: 4 additions & 1 deletion hivemind_etl/mediawiki/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ async def load_mediawiki_data(mediawiki_platform: dict[str, Any]) -> None:
"""Load the transformed MediaWiki data into the database."""
community_id = mediawiki_platform["community_id"]
namespaces = mediawiki_platform["namespaces"]

try:
documents = mediawiki_platform["documents"]
documents_dict = mediawiki_platform["documents"]
# temporal had converted them to dicts, so we need to convert them back to Document objects
documents = [Document.from_dict(doc) for doc in documents_dict]

logging.info(f"Starting data load for community {community_id}")
mediawiki_etl = MediawikiETL(community_id=community_id, namespaces=namespaces)
Expand Down
3 changes: 3 additions & 0 deletions hivemind_etl/mediawiki/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ def transform(self) -> list[Document]:
return documents

def load(self, documents: list[Document]) -> None:
logging.info(f"Loading {len(documents)} documents into Qdrant!")
ingestion_pipeline = CustomIngestionPipeline(
self.community_id, collection_name="mediawiki"
)
ingestion_pipeline.run_pipeline(documents)
logging.info(f"Loaded {len(documents)} documents into Qdrant!")

if self.delete_dump_after_load:
logging.info(f"Removing dump directory {self.dump_dir}!")
shutil.rmtree(self.dump_dir)