Skip to content

Commit

Permalink
curation: add 12hr buffer; log record moved
Browse files Browse the repository at this point in the history
  • Loading branch information
yashlamba committed Dec 10, 2024
1 parent 73f57cd commit 93a8444
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions site/zenodo_rdm/curation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""Tasks for curation."""

from datetime import datetime, timedelta, timezone
from tkinter import HORIZONTAL

from celery import shared_task
from flask import current_app
Expand All @@ -20,7 +21,7 @@
@shared_task
def run_eu_record_curation(since):
"""Run EC Curator."""
ctx = {"processed": 0, "approved": 0, "failed": 0, "since": since}
ctx = {"processed": 0, "approved": 0, "failed": 0, "since": since, "records_moved": []}
dry_run = not current_app.config.get("CURATION_ENABLE_EU_CURATOR")
curator = EURecordCurator(dry=dry_run)

Expand All @@ -40,7 +41,7 @@ def run_eu_record_curation(since):
dsl.Q(
"range",
updated={
"gte": datetime.fromisoformat(since).isoformat(),
"gte": datetime.fromisoformat(since).isoformat() - timedelta(hours=12),
},
),
],
Expand Down Expand Up @@ -69,6 +70,8 @@ def run_eu_record_curation(since):
ctx["processed"] += 1
if result["evaluation"]:
ctx["approved"] += 1
if not dry_run:
ctx["records_moved"].append(record.pid.pid_value)
except Exception:
# NOTE Since curator's raise_rules_exc is by default false, rules would not fail.
# This catches failures due to other reasons
Expand Down

0 comments on commit 93a8444

Please sign in to comment.