File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 1616import registry as registry
1717import utils .app as app
1818import utils .log as log
19+ from base_exception import InitializationError
1920from utils .exception_handling import protected_task
2021
2122_logger = logging .getLogger ("main" )
@@ -26,6 +27,11 @@ async def init(controller_enabled: bool, executor_enabled: bool) -> None:
2627 they start with or without the controller."""
2728 # Log setup must be the first one
2829 log .setup ()
30+
31+ # Check database migrations
32+ await internal_database .check_database ()
33+
34+ # Application startup
2935 app .setup ()
3036 registry .init ()
3137
@@ -60,10 +66,18 @@ async def main() -> None:
6066 else :
6167 operation_modes = sys .argv [1 :]
6268
63- await init (
64- controller_enabled = "controller" in operation_modes ,
65- executor_enabled = "executor" in operation_modes ,
66- )
69+ try :
70+ await init (
71+ controller_enabled = "controller" in operation_modes ,
72+ executor_enabled = "executor" in operation_modes ,
73+ )
74+ except InitializationError as e :
75+ _logger .error ("Failed to initialize" )
76+ _logger .error (e )
77+ return
78+ except Exception :
79+ _logger .error ("Failed to initialize" , exc_info = True )
80+ return
6781
6882 modes = {
6983 "controller" : controller .run ,
You can’t perform that action at this time.
0 commit comments