It implements a strategy for cleaning stale files from the filesystem.
Implementation just uses the django-oseoserver hook for cleaning items. oseoserver features the oseoserver.tasks.clean_expired_items function, which is a celery task. This task calls the OrderItem.expire method which in turn calls in a customizable clean_item method that can be attached to an ItemProcessor class.
In this PR we implement the gfdrr_det.orderprocessors.HeveOrderProcessor.clean_item method. It basically checks if the file served by a specific URL is still being used by any available order item and deletes the file if it is not being used.
The oseoserver task that deals with order item expiry is not enabled by default and must be configured to run manually. This PR sets up a celery beat schedule for running the task everyday at 01:00.
Finally this PR sets also a couple other celery settings, most notably it sets CELERY_TASK_ALWAYS_EAGER = True in order to enable parallelization of tasks.
Note
In order to activate the celery beat schedule it is necessary to configure the server appropriately, as specified in
This PR is connected to #86
It implements a strategy for cleaning stale files from the filesystem.
Implementation just uses the django-oseoserver hook for cleaning items. oseoserver features the
oseoserver.tasks.clean_expired_items
function, which is a celery task. This task calls theOrderItem.expire
method which in turn calls in a customizableclean_item
method that can be attached to an ItemProcessor class.In this PR we implement the
gfdrr_det.orderprocessors.HeveOrderProcessor.clean_item
method. It basically checks if the file served by a specific URL is still being used by any available order item and deletes the file if it is not being used.The oseoserver task that deals with order item expiry is not enabled by default and must be configured to run manually. This PR sets up a celery beat schedule for running the task everyday at 01:00.
Finally this PR sets also a couple other celery settings, most notably it sets
CELERY_TASK_ALWAYS_EAGER = True
in order to enable parallelization of tasks.Note
In order to activate the celery beat schedule it is necessary to configure the server appropriately, as specified in
http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#starting-the-scheduler
This step shall be done after the PR is merged.