research-rainfallradar/aimodel/src/index.py

34 lines
706 B
Python
Raw Normal View History

2022-07-25 18:00:53 +00:00
#!/usr/bin/env python3
import importlib
import sys
from datetime import datetime
2022-07-25 18:00:53 +00:00
from loguru import logger
def init_logging():
pass
from parse_args import parse_args
def main():
subcommand, args = parse_args()
if args == None:
return
time_start = datetime.utcnow()
logger.info(f"Time: Starting subcommand {subcommand} at {str(datetime.utcnow().isoformat())}")
2022-07-25 18:00:53 +00:00
imported_module = importlib.import_module(f"subcommands.{subcommand}")
2022-08-04 15:49:53 +00:00
imported_module.run(args)
2022-07-25 18:00:53 +00:00
logger.info(f"*** complete in {str((datetime.now() - time_start).total_seconds())} seconds ***")
2022-07-25 18:00:53 +00:00
if __name__ == "__main__":
main()
else:
print("This script must be run directly. It cannot be imported.")
exit(1)