mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-26 01:29:10 +00:00
superscript.py v 0.8.2
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
f9fd61e8a5
commit
d97976da12
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"max-threads": 1,
|
"max-threads": 0.5,
|
||||||
"team": "",
|
"team": "",
|
||||||
"competition": "2020ilch",
|
"competition": "",
|
||||||
"key":{
|
"key":{
|
||||||
"database":"",
|
"database":"",
|
||||||
"tba":""
|
"tba":""
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
# Notes:
|
# Notes:
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "0.8.1"
|
__version__ = "0.8.2"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
0.8.2:
|
||||||
|
- readded while true to main function
|
||||||
|
- added more thread config options
|
||||||
0.8.1:
|
0.8.1:
|
||||||
- optimized matchloop further by bypassing GIL
|
- optimized matchloop further by bypassing GIL
|
||||||
0.8.0:
|
0.8.0:
|
||||||
@ -121,7 +124,9 @@ from tra_analysis import analysis as an
|
|||||||
import data as d
|
import data as d
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import json
|
import json
|
||||||
|
import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import os
|
||||||
from os import system, name
|
from os import system, name
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
@ -138,7 +143,7 @@ def main():
|
|||||||
|
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|
||||||
# while (True):
|
while (True):
|
||||||
|
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
print("[OK] time: " + str(current_time))
|
print("[OK] time: " + str(current_time))
|
||||||
@ -151,8 +156,21 @@ def main():
|
|||||||
print("[OK] configs loaded")
|
print("[OK] configs loaded")
|
||||||
|
|
||||||
print("[OK] starting threads")
|
print("[OK] starting threads")
|
||||||
exec_threads = Pool(processes = config["max-threads"])
|
cfg_max_threads = config["max-threads"]
|
||||||
print("[OK] threads started")
|
sys_max_threads = os.cpu_count()
|
||||||
|
if cfg_max_threads > -sys_max_threads and cfg_max_threads < 0 :
|
||||||
|
alloc_processes = sys_max_threads + cfg_max_threads
|
||||||
|
elif cfg_max_threads > 0 and cfg_max_threads < 1:
|
||||||
|
alloc_processes = math.floor(cfg_max_threads * sys_max_threads)
|
||||||
|
elif cfg_max_threads > 1 and cfg_max_threads <= sys_max_threads:
|
||||||
|
alloc_processes = cfg_max_threads
|
||||||
|
elif cfg_max_threads == 0:
|
||||||
|
alloc_processes = sys_max_threads
|
||||||
|
else:
|
||||||
|
print("[Err] Invalid number of processes, must be between -" + str(sys_max_threads) + " and " + str(sys_max_threads))
|
||||||
|
exit()
|
||||||
|
exec_threads = Pool(processes = alloc_processes)
|
||||||
|
print("[OK] " + str(alloc_processes) + " threads started")
|
||||||
|
|
||||||
apikey = config["key"]["database"]
|
apikey = config["key"]["database"]
|
||||||
tbakey = config["key"]["tba"]
|
tbakey = config["key"]["tba"]
|
||||||
@ -185,7 +203,7 @@ def main():
|
|||||||
set_current_time(apikey, current_time)
|
set_current_time(apikey, current_time)
|
||||||
print("[OK] finished all tests, looping")
|
print("[OK] finished all tests, looping")
|
||||||
|
|
||||||
#clear()
|
clear()
|
||||||
|
|
||||||
def clear():
|
def clear():
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user