-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.py
41 lines (29 loc) · 927 Bytes
/
main.py
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
from settings import set_system_path
set_system_path()
from nyuntam.factory import Factory
from nyuntam.utils.logger import set_logger
from nyuntam.commands import get_args
set_logger()
import logging
def main():
args = get_args()
try:
if args.yaml_path:
factory = Factory.create_from_yaml(args.yaml_path)
else:
factory = Factory.create_from_json(args.json_path)
except Exception as e:
logging.exception(f"Failed to create Factory instance: {e}")
raise
assert factory is not None, "Factory instance could not be created."
logging.info(
f"Running job with configuration: {factory.algorithm.__class__.__name__}"
)
try:
factory.run()
logging.info("Job completed successfully.")
except Exception as e:
logging.exception(f"Failed to run job: {e}")
raise
if __name__ == "__main__":
main()