Spaces:
Sleeping
Sleeping
Upload cloud_config.py
Browse files- cloud_config.py +43 -0
cloud_config.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Cloud deployment configuration for Job Recommendation API
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
# Cloud deployment settings
|
| 7 |
+
CLOUD_DEPLOYMENT = os.getenv("CLOUD_DEPLOYMENT", "false").lower() == "true"
|
| 8 |
+
|
| 9 |
+
# Timeout configurations
|
| 10 |
+
if CLOUD_DEPLOYMENT:
|
| 11 |
+
# Longer timeouts for cloud environments
|
| 12 |
+
EXTERNAL_API_TIMEOUT = 120 # 2 minutes
|
| 13 |
+
LOGIN_TIMEOUT = 30
|
| 14 |
+
MAX_JOBS_TO_ANALYZE = 10
|
| 15 |
+
REQUEST_TIMEOUT = 300 # 5 minutes total
|
| 16 |
+
else:
|
| 17 |
+
# Standard timeouts for local development
|
| 18 |
+
EXTERNAL_API_TIMEOUT = 60 # 1 minute
|
| 19 |
+
LOGIN_TIMEOUT = 10
|
| 20 |
+
MAX_JOBS_TO_ANALYZE = 20
|
| 21 |
+
REQUEST_TIMEOUT = 180 # 3 minutes total
|
| 22 |
+
|
| 23 |
+
# Retry configurations
|
| 24 |
+
MAX_RETRIES = 3
|
| 25 |
+
RETRY_DELAY_BASE = 2 # seconds
|
| 26 |
+
|
| 27 |
+
# Database configurations for cloud
|
| 28 |
+
if CLOUD_DEPLOYMENT:
|
| 29 |
+
DB_POOL_SIZE = 5
|
| 30 |
+
DB_MAX_OVERFLOW = 10
|
| 31 |
+
DB_POOL_TIMEOUT = 30
|
| 32 |
+
else:
|
| 33 |
+
DB_POOL_SIZE = 10
|
| 34 |
+
DB_MAX_OVERFLOW = 20
|
| 35 |
+
DB_POOL_TIMEOUT = 30
|
| 36 |
+
|
| 37 |
+
# Logging configuration
|
| 38 |
+
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
|
| 39 |
+
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 40 |
+
|
| 41 |
+
# Performance monitoring
|
| 42 |
+
ENABLE_PERFORMANCE_MONITORING = CLOUD_DEPLOYMENT
|
| 43 |
+
PERFORMANCE_LOG_INTERVAL = 10 # seconds
|