-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmain_daemon.py
More file actions
47 lines (41 loc) · 1.05 KB
/
Copy pathmain_daemon.py
File metadata and controls
47 lines (41 loc) · 1.05 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
"""main_daemon.py
────────────────
Standard entry point for the Aura Cognitive Daemon.
"""
import asyncio
import logging
import sys
import tempfile
from pathlib import Path
# Add core to path
sys.path.append(str(Path(__file__).parent))
from core.ops.daemon import main
_DAEMON_RECOVERABLE_ERRORS = (
ImportError,
AttributeError,
RuntimeError,
TimeoutError,
OSError,
ConnectionError,
LookupError,
TypeError,
ValueError,
PermissionError,
)
if __name__ == "__main__":
# Setup basic logging for the daemon process itself
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(name)s: %(message)s',
handlers=[
logging.StreamHandler(),
logging.FileHandler(Path(tempfile.gettempdir()) / "aura_daemon.log", mode='a')
]
)
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
except _DAEMON_RECOVERABLE_ERRORS as e:
logging.critical("Daemon crashed: %s", e)
sys.exit(1)