mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-12 22:26:18 +00:00
removed match printing,
CLI args use argparse Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
64ea7c227c
commit
5885224231
@ -255,8 +255,6 @@ class Metric (Module):
|
|||||||
temp_vector.update(red)
|
temp_vector.update(red)
|
||||||
temp_vector.update(blu)
|
temp_vector.update(blu)
|
||||||
|
|
||||||
print(match)
|
|
||||||
|
|
||||||
self.results[match['match']] = temp_vector
|
self.results[match['match']] = temp_vector
|
||||||
|
|
||||||
self.client.push_metric(temp_vector)
|
self.client.push_metric(temp_vector)
|
||||||
|
@ -148,7 +148,7 @@ __author__ = (
|
|||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
import sys, time, traceback, warnings
|
import argparse, sys, time, traceback, warnings
|
||||||
from config import Configuration, ConfigurationError
|
from config import Configuration, ConfigurationError
|
||||||
from data import Client
|
from data import Client
|
||||||
from interface import Logger
|
from interface import Logger
|
||||||
@ -261,8 +261,8 @@ def start(verbose, profile, debug, config_path):
|
|||||||
profile.enable()
|
profile.enable()
|
||||||
exit_code = main(logger, verbose, profile, debug, config_path)
|
exit_code = main(logger, verbose, profile, debug, config_path)
|
||||||
profile.disable()
|
profile.disable()
|
||||||
f = open("profile.txt", 'w+')
|
f = open("profile.txt", "w+")
|
||||||
ps = pstats.Stats(profile, stream = f).sort_stats('cumtime')
|
ps = pstats.Stats(profile, stream = f).sort_stats("cumtime")
|
||||||
ps.print_stats()
|
ps.print_stats()
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
|
||||||
@ -286,24 +286,21 @@ def start(verbose, profile, debug, config_path):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
config_path = 'config.json'
|
parser = argparse.ArgumentParser(description = "TRA data processing application.")
|
||||||
|
parser.add_argument("mode", metavar = "MODE", type = str, nargs = 1, choices = ["verbose", "profile", "debug"], help = "verbose, debug, profile")
|
||||||
|
parser.add_argument("--config", dest = "config", default = "config.json", type = str, help = "path to config file")
|
||||||
|
parser.add_argument("--logfile", dest = "logfile", default = "logfile", type = str, help = "path to log file")
|
||||||
|
|
||||||
if len(sys.argv) == 2:
|
args = parser.parse_args()
|
||||||
pass
|
|
||||||
elif len(sys.argv) == 3:
|
|
||||||
config_path = sys.argv[2]
|
|
||||||
else:
|
|
||||||
print("usage: %s verbose|profile|debug <config path>" % sys.argv[0])
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
if 'verbose' == sys.argv[1]:
|
mode = args.mode[0]
|
||||||
|
config_path = args.config
|
||||||
|
log_path = args.logfile
|
||||||
|
if mode == "verbose":
|
||||||
start(True, False, False, config_path = config_path)
|
start(True, False, False, config_path = config_path)
|
||||||
elif 'profile' == sys.argv[1]:
|
elif mode == "profile":
|
||||||
start(False, True, False, config_path = config_path)
|
start(False, True, False, config_path = config_path)
|
||||||
elif 'debug' == sys.argv[1]:
|
elif mode == "debug":
|
||||||
start(False, False, True, config_path = config_path)
|
start(False, False, True, config_path = config_path)
|
||||||
else:
|
|
||||||
print("usage: %s verbose|profile|debug <config path>" % sys.argv[0])
|
exit(0)
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
sys.exit(0)
|
|
Loading…
Reference in New Issue
Block a user