|
18 | 18 |
|
19 | 19 |
|
20 | 20 | class Config: |
21 | | - # Basic settings |
22 | 21 | broker_connection_retry_on_startup = True |
23 | 22 | enable_utc = True |
24 | 23 | enable_ironic = os.environ.get("ENABLE_IRONIC", "True") |
25 | | - |
26 | | - # Redis connection settings from environment |
27 | | - _redis_host = os.environ.get("REDIS_HOST", "redis") |
28 | | - _redis_port = os.environ.get("REDIS_PORT", "6379") |
29 | | - _redis_db = os.environ.get("REDIS_DB", "0") |
30 | | - |
31 | | - broker_url = f"redis://{_redis_host}:{_redis_port}/{_redis_db}" |
32 | | - result_backend = f"redis://{_redis_host}:{_redis_port}/{_redis_db}" |
33 | | - |
34 | | - # Connection pool settings |
35 | | - broker_pool_limit = int(os.environ.get("CELERY_BROKER_POOL_LIMIT", "10")) |
36 | | - redis_max_connections = int(os.environ.get("CELERY_REDIS_MAX_CONNECTIONS", "20")) |
37 | | - |
38 | | - # Redis transport options for reliability |
39 | | - broker_transport_options = { |
40 | | - "visibility_timeout": int( |
41 | | - os.environ.get("CELERY_VISIBILITY_TIMEOUT", "43200") |
42 | | - ), # 12 hours |
43 | | - "socket_timeout": 30, |
44 | | - "socket_connect_timeout": 30, |
45 | | - "retry_on_timeout": True, |
46 | | - "health_check_interval": 10, |
47 | | - } |
48 | | - |
49 | | - # Result backend transport options |
50 | | - result_backend_transport_options = { |
51 | | - "socket_timeout": 30, |
52 | | - "socket_connect_timeout": 30, |
53 | | - "retry_on_timeout": True, |
54 | | - } |
55 | | - |
56 | | - # Task acknowledgement settings - acknowledge after completion |
57 | | - task_acks_late = True |
58 | | - task_reject_on_worker_lost = True |
59 | | - |
60 | | - # Worker settings - prevent task hoarding |
61 | | - worker_prefetch_multiplier = 1 |
62 | | - |
63 | | - # Heartbeat for connection detection |
64 | | - broker_heartbeat = int(os.environ.get("CELERY_BROKER_HEARTBEAT", "10")) |
65 | | - |
66 | | - # Task time limits (can be overridden per-task) |
67 | | - task_time_limit = int( |
68 | | - os.environ.get("CELERY_TASK_TIME_LIMIT", "86400") |
69 | | - ) # 24h hard limit |
70 | | - task_soft_time_limit = int( |
71 | | - os.environ.get("CELERY_TASK_SOFT_TIME_LIMIT", "82800") |
72 | | - ) # 23h soft limit |
73 | | - |
74 | | - # Queue settings |
| 24 | + broker_url = "redis://redis" |
| 25 | + result_backend = "redis://redis" |
75 | 26 | task_create_missing_queues = True |
76 | 27 | task_default_queue = "default" |
77 | | - task_track_started = True |
| 28 | + task_track_started = (True,) |
78 | 29 | task_routes = { |
79 | 30 | "osism.tasks.ansible.*": {"queue": "osism-ansible"}, |
80 | 31 | "osism.tasks.ceph.*": {"queue": "ceph-ansible"}, |
|
0 commit comments