Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(documents): delete orphan harvested documents #3777

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

PascalRepond
Copy link
Contributor

if delete:
try:
if doc.reasons_not_to_delete() == {"others": {"harvested": True}}:
doc.delete(dbcommit=True, delindex=True, force=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure force=True will do the trick. Force will delete the persistent identifier in DB. I think yo have to set harvested to False before deleting.

* Closes rero#3776.

Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
@PascalRepond PascalRepond requested review from jma and removed request for jma November 18, 2024 09:20
for pid in pids:
if doc := Document.get_record_by_pid(pid):
if verbose:
click.secho(f"Deleting orphan harvested: {pid}", fg="yellow")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is available only using python click.

except Exception:
msg = f"COULD NOT DELETE ORPHAN HARVESTED: {pid} {doc.reasons_not_to_delete()}"
if verbose:
click.secho(f"ERROR: {msg}", fg="red")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@PascalRepond PascalRepond merged commit 1c0afde into rero:staging Nov 20, 2024
4 checks passed
@PascalRepond PascalRepond deleted the rep-harvest branch November 20, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Periodically delete orphan harvested documents
3 participants