2023-04-06 17:26:36 +00:00
|
|
|
import os
|
|
|
|
from celery import Celery
|
2023-04-08 10:16:05 +00:00
|
|
|
from plane.settings.redis import redis_instance
|
2023-07-11 09:05:20 +00:00
|
|
|
from celery.schedules import crontab
|
2023-04-06 17:26:36 +00:00
|
|
|
|
|
|
|
# Set the default Django settings module for the 'celery' program.
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plane.settings.production")
|
|
|
|
|
2023-04-08 10:16:05 +00:00
|
|
|
ri = redis_instance()
|
|
|
|
|
2023-04-06 17:26:36 +00:00
|
|
|
app = Celery("plane")
|
|
|
|
|
|
|
|
# Using a string here means the worker will not have to
|
|
|
|
# pickle the object when using Windows.
|
|
|
|
app.config_from_object("django.conf:settings", namespace="CELERY")
|
|
|
|
|
2023-07-11 09:05:20 +00:00
|
|
|
app.conf.beat_schedule = {
|
|
|
|
# Executes every day at 12 AM
|
|
|
|
"check-every-day-to-archive-and-close": {
|
|
|
|
"task": "plane.bgtasks.issue_automation_task.archive_and_close_old_issues",
|
|
|
|
"schedule": crontab(hour=0, minute=0),
|
|
|
|
},
|
2023-08-11 14:39:52 +00:00
|
|
|
"check-every-day-to-delete_exporter_history": {
|
|
|
|
"task": "plane.bgtasks.exporter_expired_task.delete_old_s3_link",
|
|
|
|
"schedule": crontab(hour=0, minute=0),
|
|
|
|
},
|
2023-07-11 09:05:20 +00:00
|
|
|
}
|
|
|
|
|
2023-04-06 17:26:36 +00:00
|
|
|
# Load task modules from all registered Django app configs.
|
|
|
|
app.autodiscover_tasks()
|
2023-07-11 09:05:20 +00:00
|
|
|
|
2023-11-01 15:05:06 +00:00
|
|
|
app.conf.beat_scheduler = 'django_celery_beat.schedulers.DatabaseScheduler'
|