parent
55899a9b63
commit
12fd2b6b6e
|
@ -6,10 +6,11 @@ import python_artnet as Artnet
|
||||||
import os
|
import os
|
||||||
from getmac import get_mac_address
|
from getmac import get_mac_address
|
||||||
import time
|
import time
|
||||||
import sys
|
|
||||||
from multiprocessing import Process, Pipe, Queue
|
from multiprocessing import Process, Pipe, Queue
|
||||||
from queue import Empty
|
from queue import Empty
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
|
import cProfile
|
||||||
|
import pstats
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@ -144,7 +145,6 @@ def mqtt_publisher(ti_receiver):
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
artNet.close()
|
artNet.close()
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
def tube_index_updater(ti_queue):
|
def tube_index_updater(ti_queue):
|
||||||
while True:
|
while True:
|
||||||
|
@ -172,13 +172,19 @@ def tube_index_collector(ti_queue, ti_sender):
|
||||||
ti_sender.send(None)
|
ti_sender.send(None)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
(ti_receiver,ti_sender) = Pipe(True)
|
with cProfile.Profile as profile:
|
||||||
ti_queue = Queue()
|
try:
|
||||||
collector_thread = Process(target=tube_index_collector, args=(ti_queue, ti_sender, ))
|
(ti_receiver,ti_sender) = Pipe(True)
|
||||||
collector_thread.start()
|
ti_queue = Queue()
|
||||||
ti_updater_thread = Process(target=tube_index_updater, args=(ti_queue, ))
|
collector_thread = Process(target=tube_index_collector, args=(ti_queue, ti_sender, ))
|
||||||
ti_updater_thread.start()
|
collector_thread.start()
|
||||||
publisher_thread = Process(target=mqtt_publisher, args=(ti_receiver, ))
|
ti_updater_thread = Process(target=tube_index_updater, args=(ti_queue, ))
|
||||||
publisher_thread.start()
|
ti_updater_thread.start()
|
||||||
flask_thread = Process(target=flask_api)
|
publisher_thread = Process(target=mqtt_publisher, args=(ti_receiver, ))
|
||||||
flask_thread.start()
|
publisher_thread.start()
|
||||||
|
flask_thread = Process(target=flask_api)
|
||||||
|
flask_thread.start()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
result = pstats.Stats(profile)
|
||||||
|
result.sort_stats(pstats.SortKey.TIME)
|
||||||
|
result.print_stats()
|
Loading…
Reference in New Issue