Skip to content
Open
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
3 changes: 0 additions & 3 deletions invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ TRUSTED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1', 'localhost.cern.ch']

# TODO: Set
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://cds-rdm:cds-rdm@localhost/cds-rdm"
SQLALCHEMY_ENGINE_OPTIONS={
"connect_args": {"options": "-c timezone=UTC"}
}

# Invenio-App
# ===========
Expand Down
2 changes: 1 addition & 1 deletion site/cds_rdm/inspire_harvester/load/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def new_version(self, record_pid):
"""Create a new-version draft from an existing published record."""
return current_rdm_records_service.new_version(system_identity, record_pid)

def add_community(self, draft):
def add_cern_research_community(self, draft):
"""Add the CERN Scientific Community to the draft."""
with db.session.begin_nested():
community_id = current_app.config["CDS_CERN_SCIENTIFIC_COMMUNITY_ID"]
Expand Down
7 changes: 4 additions & 3 deletions site/cds_rdm/inspire_harvester/load/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RetryConfig:


@dataclass
class FileDiff:
class FileChecksumsDiff:
"""Diff between existing and new file sets, keyed by checksum."""

to_add: List[str] # checksums of new files to upload
Expand All @@ -43,12 +43,12 @@ def __init__(self, retry_config: RetryConfig = None):
"""Constructor."""
self.retry_config = retry_config or RetryConfig()

def compute_diff(self, existing_files, new_files) -> FileDiff:
def compute_diff(self, existing_files, new_files) -> FileChecksumsDiff:
"""Return the set difference between existing and new file checksums."""
existing_checksums = [value["checksum"] for value in existing_files.values()]
new_checksums = [value["checksum"] for value in new_files.values()]

return FileDiff(
return FileChecksumsDiff(
to_add=list(set(new_checksums) - set(existing_checksums)),
to_delete=list(set(existing_checksums) - set(new_checksums)),
existing=list(set(existing_checksums)),
Expand Down Expand Up @@ -175,6 +175,7 @@ def _upload_file(self, draft, file_data, file_content, logger):
file_data_to_init = {
k: v for k, v in file_data.items() if k != "source_url"
}
logger.debug(f"Filename: '{file_data['key']}' initializing.")
service.draft_files.init_files(
system_identity, draft.id, [file_data_to_init]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def filter(self, file):
return False
if (not material or material == "preprint") and source == "arxiv":
return True
if source == "CDS":
if source and source.lower() == "cds":
# include it to check the file
return True
return False
Expand Down
2 changes: 1 addition & 1 deletion site/cds_rdm/inspire_harvester/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def _create_record(
self.file_sync.sync(draft, {}, entry, logger)
logger.info("All the files successfully created.")

self.drafts.add_community(draft)
self.drafts.add_cern_research_community(draft)
except Exception:
current_rdm_records_service.delete_draft(system_identity, draft.id)
logger.error(f"Draft {draft.id} is deleted due to errors.")
Expand Down
2 changes: 1 addition & 1 deletion site/tests/inspire_harvester/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS RDM is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down
2 changes: 1 addition & 1 deletion site/tests/inspire_harvester/test_harvester_job.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
Expand Down
2 changes: 1 addition & 1 deletion site/tests/inspire_harvester/test_transformer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the GPL-2.0 License; see LICENSE file for more details.
Expand Down
2 changes: 1 addition & 1 deletion site/tests/inspire_harvester/test_writer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the GPL-2.0 License; see LICENSE file for more details.
Expand Down
2 changes: 1 addition & 1 deletion site/tests/inspire_harvester/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS RDM is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down
2 changes: 1 addition & 1 deletion site/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 CERN.
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
Expand Down
Loading