1
+ from django .conf import settings
2
+
3
+ from scheduler .settings import conf_settings , SCHEDULER_CONFIG
4
+ from scheduler .tests .testtools import SchedulerBaseCase
5
+ from scheduler .types import Broker
6
+
7
+
8
+ class TestWorkerAdmin (SchedulerBaseCase ):
9
+
10
+ def test_scheduler_config_as_dict (self ):
11
+ self .assertEqual (SCHEDULER_CONFIG .EXECUTIONS_IN_PAGE , 20 )
12
+ settings .SCHEDULER_CONFIG = dict (
13
+ EXECUTIONS_IN_PAGE = 1 ,
14
+ SCHEDULER_INTERVAL = 10 ,
15
+ BROKER = Broker .REDIS ,
16
+ CALLBACK_TIMEOUT = 60 , # Callback timeout in seconds (success/failure/stopped)
17
+ # Default values, can be overriden per task/job
18
+ DEFAULT_SUCCESS_TTL = 10 * 60 , # Time To Live (TTL) in seconds to keep successful job results
19
+ DEFAULT_FAILURE_TTL = 365 * 24 * 60 * 60 , # Time To Live (TTL) in seconds to keep job failure information
20
+ DEFAULT_JOB_TTL = 10 * 60 , # Time To Live (TTL) in seconds to keep job information
21
+ DEFAULT_JOB_TIMEOUT = 5 * 60 , # timeout (seconds) for a job
22
+ # General configuration values
23
+ DEFAULT_WORKER_TTL = 10 * 60 , # Time To Live (TTL) in seconds to keep worker information after last heartbeat
24
+ DEFAULT_MAINTENANCE_TASK_INTERVAL = 10 * 60 , # The interval to run maintenance tasks in seconds. 10 minutes.
25
+ DEFAULT_JOB_MONITORING_INTERVAL = 30 , # The interval to monitor jobs in seconds.
26
+ SCHEDULER_FALLBACK_PERIOD_SECS = 120 , # Period (secs) to wait before requiring to reacquire locks
27
+ )
28
+ conf_settings ()
29
+ self .assertEqual (SCHEDULER_CONFIG .EXECUTIONS_IN_PAGE , 1 )
0 commit comments