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

The clear_orphaned_files task cannot be scheduled like the documentation says #290

Open
max-moser opened this issue Mar 29, 2023 · 0 comments

Comments

@max-moser
Copy link
Contributor

Package version (if known): 1.5.0

Describe the bug

The clear_orphaned_files task specifies that i can be scheduled by adding a configuration entry to the CELERY_BEAT_SCHEDULE like so:

from invenio_app_rdm.config import CELERY_BEAT_SCHEDULE

CELERY_BEAT_SCHEDULE["clear-orphan-files"] = {
  "task": "invenio_files_rest.tasks.clear_orphaned_files",
  "schedule": 60 * 60 * 24,
  "kwargs": {
    "force_delete_check": lambda file: False,
    "limit": 500,
  }
}

However, this doesn't seem to work because the force_delete_check argument (lambda file: False) can't be pickled.
We need to find an alternative way of how to pass the check to the task in a pickle-friendly way.
I'm thinking of a classic object_or_import_string here, maybe there's better alternatives though.

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

No branches or pull requests

1 participant