diff --git a/invenio.cfg b/invenio.cfg index 9d218e3f..82896af8 100644 --- a/invenio.cfg +++ b/invenio.cfg @@ -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 # =========== diff --git a/site/cds_rdm/inspire_harvester/load/draft.py b/site/cds_rdm/inspire_harvester/load/draft.py index 1aae885d..c666ac08 100644 --- a/site/cds_rdm/inspire_harvester/load/draft.py +++ b/site/cds_rdm/inspire_harvester/load/draft.py @@ -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"] diff --git a/site/cds_rdm/inspire_harvester/load/files.py b/site/cds_rdm/inspire_harvester/load/files.py index e8edd90a..ccf3bead 100644 --- a/site/cds_rdm/inspire_harvester/load/files.py +++ b/site/cds_rdm/inspire_harvester/load/files.py @@ -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 @@ -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)), @@ -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] ) diff --git a/site/cds_rdm/inspire_harvester/transform/mappers/preprint.py b/site/cds_rdm/inspire_harvester/transform/mappers/preprint.py index ce4004e3..9c56e3c8 100644 --- a/site/cds_rdm/inspire_harvester/transform/mappers/preprint.py +++ b/site/cds_rdm/inspire_harvester/transform/mappers/preprint.py @@ -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 diff --git a/site/cds_rdm/inspire_harvester/writer.py b/site/cds_rdm/inspire_harvester/writer.py index 39f8f6f0..0df2bce7 100644 --- a/site/cds_rdm/inspire_harvester/writer.py +++ b/site/cds_rdm/inspire_harvester/writer.py @@ -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.") diff --git a/site/tests/inspire_harvester/conftest.py b/site/tests/inspire_harvester/conftest.py index 6f55aed8..6a5e5c29 100644 --- a/site/tests/inspire_harvester/conftest.py +++ b/site/tests/inspire_harvester/conftest.py @@ -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. diff --git a/site/tests/inspire_harvester/test_harvester_job.py b/site/tests/inspire_harvester/test_harvester_job.py index 607053a2..ad17050e 100644 --- a/site/tests/inspire_harvester/test_harvester_job.py +++ b/site/tests/inspire_harvester/test_harvester_job.py @@ -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. diff --git a/site/tests/inspire_harvester/test_metadata_only_new_version.py b/site/tests/inspire_harvester/test_metadata_only_new_version.py index aa8e6989..3c160184 100644 --- a/site/tests/inspire_harvester/test_metadata_only_new_version.py +++ b/site/tests/inspire_harvester/test_metadata_only_new_version.py @@ -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. diff --git a/site/tests/inspire_harvester/test_multiple_document_types_external.py b/site/tests/inspire_harvester/test_multiple_document_types_external.py index d21c0b4c..c49225a8 100644 --- a/site/tests/inspire_harvester/test_multiple_document_types_external.py +++ b/site/tests/inspire_harvester/test_multiple_document_types_external.py @@ -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. diff --git a/site/tests/inspire_harvester/test_transformer.py b/site/tests/inspire_harvester/test_transformer.py index 1aae69fa..40fc388e 100644 --- a/site/tests/inspire_harvester/test_transformer.py +++ b/site/tests/inspire_harvester/test_transformer.py @@ -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. diff --git a/site/tests/inspire_harvester/test_writer.py b/site/tests/inspire_harvester/test_writer.py index 5825e485..2902a81e 100644 --- a/site/tests/inspire_harvester/test_writer.py +++ b/site/tests/inspire_harvester/test_writer.py @@ -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. diff --git a/site/tests/inspire_harvester/utils.py b/site/tests/inspire_harvester/utils.py index 6aae8614..6f44c43e 100644 --- a/site/tests/inspire_harvester/utils.py +++ b/site/tests/inspire_harvester/utils.py @@ -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. diff --git a/site/tests/utils.py b/site/tests/utils.py index 3805300b..d239e4e2 100644 --- a/site/tests/utils.py +++ b/site/tests/utils.py @@ -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.