Reverting to django tasks scheduler version

This commit is contained in:
Luciano Gervasoni
2025-04-06 21:03:57 +02:00
parent 7f246089b9
commit 64d2efd314
2 changed files with 36 additions and 6 deletions

View File

@@ -11,7 +11,6 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
"""
from pathlib import Path
from scheduler.types import SchedulerConfiguration
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -111,7 +110,35 @@ CACHES = {
}
}
'''
from scheduler.types import SchedulerConfiguration, QueueConfiguration, Broker
from typing import Dict
# https://django-tasks-scheduler.readthedocs.io/en/latest/configuration/
SCHEDULER_CONFIG = SchedulerConfiguration(
DEFAULT_JOB_TIMEOUT = os.environ.get("JOB_DEFAULT_TIMEOUT", 60*30), # 30 minutes
BROKER=Broker.REDIS,
)
SCHEDULER_QUEUES: Dict[str, QueueConfiguration] = {
'default': QueueConfiguration(
HOST = os.environ.get("REDIS_HOST", "localhost"),
PORT = os.environ.get("REDIS_PORT", 6379),
DB = os.environ.get("REDIS_DB", 0),
),
'high': QueueConfiguration(
HOST = os.environ.get("REDIS_HOST", "localhost"),
PORT = os.environ.get("REDIS_PORT", 6379),
DB = os.environ.get("REDIS_DB", 0),
),
'low': QueueConfiguration(
HOST = os.environ.get("REDIS_HOST", "localhost"),
PORT = os.environ.get("REDIS_PORT", 6379),
DB = os.environ.get("REDIS_DB", 0),
),
}
'''
SCHEDULER_QUEUES = {
'default': {
'HOST': os.environ.get("REDIS_HOST", "localhost"),
@@ -129,10 +156,13 @@ SCHEDULER_QUEUES = {
'DB': os.environ.get("REDIS_DB", 0),
}
}
SCHEDULER_CONFIG = {
'DEFAULT_TIMEOUT': os.environ.get("JOB_DEFAULT_TIMEOUT", 60*30), # 30 minutes
'DEFAULT_RESULT_TTL': 60*60*12, # 12 hours
'EXECUTIONS_IN_PAGE': 20,
'SCHEDULER_INTERVAL': 10, # 10 seconds
}
SCHEDULER_CONFIG = SchedulerConfiguration(
DEFAULT_JOB_TIMEOUT = os.environ.get("JOB_DEFAULT_TIMEOUT", 60*30), # 30 minutes
)
# Password validation

View File

@@ -1,7 +1,7 @@
django==5.1
psycopg[binary]
django-tasks-scheduler==3.0.1
django-redis
django-tasks-scheduler
psycopg[binary]
gunicorn
whitenoise
feedparser