|
|
|
|
@@ -12,6 +12,9 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
|
|
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
import os
|
|
|
|
|
from typing import Dict
|
|
|
|
|
from scheduler.types import SchedulerConfiguration, Broker, QueueConfiguration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
@@ -107,57 +110,27 @@ 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
|
|
|
|
|
EXECUTIONS_IN_PAGE=20,
|
|
|
|
|
SCHEDULER_INTERVAL=10,
|
|
|
|
|
BROKER=Broker.REDIS,
|
|
|
|
|
CALLBACK_TIMEOUT=60, # Callback timeout in seconds (success/failure/stopped)
|
|
|
|
|
# Default values, can be overriden per task/job
|
|
|
|
|
DEFAULT_SUCCESS_TTL=10 * 60, # Time To Live (TTL) in seconds to keep successful job results
|
|
|
|
|
DEFAULT_FAILURE_TTL=365 * 24 * 60 * 60, # Time To Live (TTL) in seconds to keep job failure information
|
|
|
|
|
DEFAULT_JOB_TTL=10 * 60, # Time To Live (TTL) in seconds to keep job information
|
|
|
|
|
DEFAULT_JOB_TIMEOUT=30 * 60, # timeout (seconds) for a job
|
|
|
|
|
# General configuration values
|
|
|
|
|
DEFAULT_WORKER_TTL=10 * 60, # Time To Live (TTL) in seconds to keep worker information after last heartbeat
|
|
|
|
|
DEFAULT_MAINTENANCE_TASK_INTERVAL=10 * 60, # The interval to run maintenance tasks in seconds. 10 minutes.
|
|
|
|
|
DEFAULT_JOB_MONITORING_INTERVAL=30, # The interval to monitor jobs in seconds.
|
|
|
|
|
SCHEDULER_FALLBACK_PERIOD_SECS=120, # Period (secs) to wait before requiring to reacquire locks
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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"),
|
|
|
|
|
'PORT': os.environ.get("REDIS_PORT", 6379),
|
|
|
|
|
'DB': os.environ.get("REDIS_DB", 0),
|
|
|
|
|
},
|
|
|
|
|
'high': {
|
|
|
|
|
'HOST': os.environ.get("REDIS_HOST", "localhost"),
|
|
|
|
|
'PORT': os.environ.get("REDIS_PORT", 6379),
|
|
|
|
|
'DB': os.environ.get("REDIS_DB", 0),
|
|
|
|
|
},
|
|
|
|
|
'low': {
|
|
|
|
|
'HOST': os.environ.get("REDIS_HOST", "localhost"),
|
|
|
|
|
'PORT': os.environ.get("REDIS_PORT", 6379),
|
|
|
|
|
'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
|
|
|
|
|
# 'default': QueueConfiguration(URL='redis://localhost:6379/0'),
|
|
|
|
|
'default': QueueConfiguration(URL='redis://{}:{}/{}'.format(os.environ.get("REDIS_HOST", "localhost"), os.environ.get("REDIS_PORT", 6379), os.environ.get("REDIS_DB", 0))),
|
|
|
|
|
'high': QueueConfiguration(URL='redis://{}:{}/{}'.format(os.environ.get("REDIS_HOST", "localhost"), os.environ.get("REDIS_PORT", 6379), os.environ.get("REDIS_DB", 0))),
|
|
|
|
|
'low': QueueConfiguration(URL='redis://{}:{}/{}'.format(os.environ.get("REDIS_HOST", "localhost"), os.environ.get("REDIS_PORT", 6379), os.environ.get("REDIS_DB", 0))),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|