mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-04 14:07:25 +00:00
add possibility to start Plugins asynchron
If you are using many Plugins or Plugins with a long execution time you could execute them in an asynchronous manner. It must be pointed out that enabling (0|1) this consume time, so don't use it for one rapid Plugin.
This commit is contained in:
parent
3e7cc1f365
commit
30320b3c71
7 changed files with 59 additions and 8 deletions
|
|
@ -11,14 +11,48 @@ Handler for the filter and plugins at an alarm
|
|||
"""
|
||||
|
||||
import logging # Global logger
|
||||
from threading import Thread
|
||||
|
||||
from includes import globals # Global variables
|
||||
|
||||
##
|
||||
#
|
||||
# decide to run AlarmHandler sync or async
|
||||
#
|
||||
def processAlarmHandler(typ, freq, data):
|
||||
"""
|
||||
Function to decide if the alarm process will call sync
|
||||
|
||||
@type typ: string (FMS|ZVEI|POC)
|
||||
@param typ: Typ of the dataset
|
||||
@type freq: string
|
||||
@param freq: frequency of the SDR Stick
|
||||
@type data: map of data (structure see interface.txt)
|
||||
@param data: Contains the parameter
|
||||
|
||||
@requires: active plugins in pluginList
|
||||
@requires: Configuration has to be set in the config.ini
|
||||
|
||||
@return: nothing
|
||||
@exception: Exception if starting a Thread failed
|
||||
"""
|
||||
if globals.config.getboolean("BOSWatch","processAlarmAsync") == True:
|
||||
logging.debug("starting processAlarm async")
|
||||
try:
|
||||
Thread(target=processAlarm, args=(typ, freq, data)).start()
|
||||
except:
|
||||
logging.error("Error in starting alarm processing async")
|
||||
logging.debug("Error in starting alarm processing async", exc_info=True)
|
||||
pass
|
||||
else:
|
||||
processAlarm(typ, freq, data)
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
# main function for central filtering and calling the plugins
|
||||
#
|
||||
def processAlarm(typ,freq,data):
|
||||
def processAlarm(typ, freq, data):
|
||||
"""
|
||||
Function to process filters and plugins at Alarm
|
||||
|
||||
|
|
@ -59,4 +93,6 @@ def processAlarm(typ,freq,data):
|
|||
pass
|
||||
logging.debug("[END ALARM]")
|
||||
except:
|
||||
logging.exception("Error in alarm processing")
|
||||
logging.error("Error in alarm processing")
|
||||
logging.debug("Error in alarm processing", exc_info=True)
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue