mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-10 06:54:45 +00:00
added event and time delay options
(event delay unimplemented)
Former-commit-id: fb4e5da1d4
This commit is contained in:
parent
9be9008ae1
commit
56d3a0adcd
@ -14,6 +14,9 @@ __changelog__ = """changelog:
|
|||||||
- added verbose option to linux superscript to allow for interactive output
|
- added verbose option to linux superscript to allow for interactive output
|
||||||
- moved pymongo import to superscript.py
|
- moved pymongo import to superscript.py
|
||||||
- added profile option to linux superscript to profile runtime of script
|
- added profile option to linux superscript to profile runtime of script
|
||||||
|
- added event and time delay options to config
|
||||||
|
- event delay pauses loop until even listener recieves an update
|
||||||
|
- time delay pauses loop until the time specified has elapsed since the BEGINNING of previous loop
|
||||||
0.9.3:
|
0.9.3:
|
||||||
- improved data loading performance by removing redundant PyMongo client creation (120s to 14s)
|
- improved data loading performance by removing redundant PyMongo client creation (120s to 14s)
|
||||||
- passed singular instance of PyMongo client as standin for apikey parameter in all data.py functions
|
- passed singular instance of PyMongo client as standin for apikey parameter in all data.py functions
|
||||||
@ -203,7 +206,9 @@ sample_json = """{
|
|||||||
"climb-mechanism":true,
|
"climb-mechanism":true,
|
||||||
"attitude":true
|
"attitude":true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"even-delay":false,
|
||||||
|
"loop-delay":60
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
def main(send, verbose = False, profile = False):
|
def main(send, verbose = False, profile = False):
|
||||||
@ -378,6 +383,12 @@ def main(send, verbose = False, profile = False):
|
|||||||
set_current_time(client, current_time)
|
set_current_time(client, current_time)
|
||||||
send(stdout, INF, "finished all tests in " + str(time.time() - loop_start) + " seconds, looping")
|
send(stdout, INF, "finished all tests in " + str(time.time() - loop_start) + " seconds, looping")
|
||||||
|
|
||||||
|
loop_delay = float(config["loop-delay"])
|
||||||
|
remaining_time = loop_delay - (time.time() - loop_start)
|
||||||
|
if remaining_time > 0:
|
||||||
|
send(stdout, INF, "loop delayed by " + str(remaining_time) + " seconds")
|
||||||
|
time.sleep(remaining_time)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
send(stdout, INF, "detected KeyboardInterrupt, killing threads")
|
send(stdout, INF, "detected KeyboardInterrupt, killing threads")
|
||||||
if "exec_threads" in locals():
|
if "exec_threads" in locals():
|
||||||
|
Loading…
Reference in New Issue
Block a user