generated from kjpou1/ml_project_template
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlaunch_host.py
More file actions
45 lines (33 loc) · 1.23 KB
/
launch_host.py
File metadata and controls
45 lines (33 loc) · 1.23 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
"""
Launch the asynchronous system.
This script initializes the application by parsing command-line arguments,
creating a Host instance, and launching its main logic asynchronously.
"""
import asyncio
from src.host import Host
from src.logger_manager import LoggerManager
from src.runtime.command_line import CommandLine
logging = LoggerManager.get_logger(__name__)
async def launch_async():
"""
Main asynchronous launch point.
Parses command-line arguments, initializes the Host instance, and
launches the main logic asynchronously.
"""
try:
args = CommandLine.parse_arguments()
logging.info("Launching host with arguments: %s", args)
if args.debug:
LoggerManager.set_log_level(logging.debug)
# Create an instance of Host with parsed arguments
instance = Host(args)
# Launch the async main function with the parsed arguments
await instance.run_async()
except ValueError as e:
logging.error("ValueError: %s", e)
except KeyboardInterrupt:
logging.info("Execution interrupted by user.")
except Exception as e:
logging.error("Unexpected error occurred: %s", e)
if __name__ == "__main__":
asyncio.run(launch_async())