2020-06-10 20:23:53 +00:00
|
|
|
import argparse
|
|
|
|
from tasks import Tasker
|
2020-06-10 23:15:34 +00:00
|
|
|
import test
|
|
|
|
import threading
|
|
|
|
from multiprocessing import Process, Queue
|
2020-06-10 20:23:53 +00:00
|
|
|
|
|
|
|
t = Tasker()
|
|
|
|
|
2020-06-10 23:15:34 +00:00
|
|
|
task_map = {"match":None, "metric":None, "pit":None, "test":None}
|
2020-06-10 20:23:53 +00:00
|
|
|
status_map = {"match":None, "metric":None, "pit":None}
|
|
|
|
status_map.update(task_map)
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(prog = "TRA")
|
|
|
|
subparsers = parser.add_subparsers(title = "command", metavar = "C", help = "//commandhelp//")
|
|
|
|
|
|
|
|
parser_start = subparsers.add_parser("start", help = "//starthelp//")
|
2020-06-10 21:47:54 +00:00
|
|
|
parser_start.add_argument("targets", metavar = "T", nargs = "*", choices = task_map.keys())
|
2020-06-10 21:32:43 +00:00
|
|
|
parser_start.set_defaults(which = "start")
|
2020-06-10 20:23:53 +00:00
|
|
|
|
|
|
|
parser_stop = subparsers.add_parser("stop", help = "//stophelp//")
|
2020-06-10 21:47:54 +00:00
|
|
|
parser_stop.add_argument("targets", metavar = "T", nargs = "*", choices = task_map.keys())
|
2020-06-10 21:32:43 +00:00
|
|
|
parser_stop.set_defaults(which = "stop")
|
2020-06-10 20:23:53 +00:00
|
|
|
|
|
|
|
parser_status = subparsers.add_parser("status", help = "//stophelp//")
|
2020-06-10 21:47:54 +00:00
|
|
|
parser_status.add_argument("targets", metavar = "T", nargs = "*", choices = status_map.keys())
|
2020-06-10 21:32:43 +00:00
|
|
|
parser_status.set_defaults(which = "status")
|
2020-06-10 20:23:53 +00:00
|
|
|
|
2020-06-10 23:15:34 +00:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
if(args.which == "start" and "test" in args.targets):
|
|
|
|
a = test.testcls()
|
|
|
|
tmain = Process(name = "main", target = a.main)
|
|
|
|
tmain.start()
|