added runtime

pull/76/head
meisnate12 4 years ago
parent 9070ea8cfc
commit a8ce3a0d92

@ -679,7 +679,9 @@ def separator(text=None):
logger.handlers[1].setFormatter(logging.Formatter(f"[%(asctime)s] %(filename)-27s %(levelname)-10s %(message)-{screen_width - 2}s"))
logger.info(f"|{separating_character * screen_width}|")
if text:
logger.info(f"| {get_centered_text(text)} |")
text_list = text.split("\n")
for t in text_list:
logger.info(f"| {get_centered_text(t)} |")
logger.info(f"|{separating_character * screen_width}|")
logger.handlers[0].setFormatter(logging.Formatter(f"| %(message)-{screen_width - 2}s |"))
logger.handlers[1].setFormatter(logging.Formatter(f"[%(asctime)s] %(filename)-27s %(levelname)-10s | %(message)-{screen_width - 2}s |"))

@ -1,4 +1,5 @@
import argparse, logging, os, re, schedule, sys, time, datetime
import argparse, logging, os, re, schedule, sys, time
from datetime import datetime
from modules import tests, util
from modules.config import Config
@ -71,6 +72,7 @@ def start(config_path, test, daily, collections):
elif test: start_type = "Test "
elif collections: start_type = "Collections "
else: start_type = ""
start_time = datetime.now()
util.separator(f"Starting {start_type}Run")
try:
config = Config(default_dir, config_path)
@ -79,7 +81,7 @@ def start(config_path, test, daily, collections):
util.print_stacktrace()
logger.critical(e)
logger.info("")
util.separator(f"Finished {start_type}Run")
util.separator(f"Finished {start_type}Run\nRun Time: {str(datetime.now() - start_time).split('.')[0]}")
try:
if args.run or args.test or args.collections:
@ -89,8 +91,8 @@ try:
schedule.every().day.at(args.time).do(start, args.config, False, True, None)
while True:
schedule.run_pending()
current = datetime.datetime.now().strftime("%H:%M")
seconds = (datetime.datetime.strptime(args.time, "%H:%M") - datetime.datetime.strptime(current, "%H:%M")).total_seconds()
current = datetime.now().strftime("%H:%M")
seconds = (datetime.strptime(args.time, "%H:%M") - datetime.strptime(current, "%H:%M")).total_seconds()
hours = int(seconds // 3600)
if hours < 0:
hours += 24

Loading…
Cancel
Save