-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_scheduler.py
More file actions
84 lines (67 loc) · 2.28 KB
/
install_scheduler.py
File metadata and controls
84 lines (67 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python3
"""
Installation script for the background cleanup scheduler
Run this after setting up the scheduler files
"""
import subprocess
import sys
import os
def install_dependencies():
"""Install required dependencies"""
print("Installing required dependencies...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("✅ Dependencies installed successfully!")
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error installing dependencies: {e}")
return False
def create_directories():
"""Create necessary directories"""
print("Creating necessary directories...")
try:
os.makedirs("marked_images", exist_ok=True)
print("✅ Created marked_images directory")
return True
except Exception as e:
print(f"❌ Error creating directories: {e}")
return False
def test_import():
"""Test if all modules can be imported"""
print("Testing module imports...")
try:
import schedule
print("✅ schedule module imported successfully")
from scheduler import MarkemImagesCleanupScheduler
print("✅ scheduler module imported successfully")
return True
except ImportError as e:
print(f"❌ Import error: {e}")
return False
def main():
"""Main installation function"""
print("=== Background Cleanup Scheduler Installation ===\n")
success = True
# Install dependencies
if not install_dependencies():
success = False
print()
# Create directories
if not create_directories():
success = False
print()
# Test imports
if not test_import():
success = False
print()
if success:
print("🎉 Installation completed successfully!")
print("\nNext steps:")
print("1. Run 'python test_scheduler.py' to test the scheduler")
print("2. Run 'python index.py' to start the main application with scheduler")
print("3. Check 'SCHEDULER_USAGE.md' for detailed usage instructions")
else:
print("❌ Installation failed. Please check the errors above.")
return success
if __name__ == "__main__":
main()