Migrated Monitor to create a new thread for subroutines
This commit is contained in:
@@ -12,4 +12,6 @@ def buildThread(module):
|
||||
|
||||
thread.start()
|
||||
|
||||
print("THREAD STARTED", thread)
|
||||
|
||||
return thread
|
||||
|
||||
@@ -23,13 +23,19 @@ def registerLifecycle(module, lifecycles):
|
||||
#print(lifecycles)
|
||||
|
||||
if "mode" not in lifecycles[module.name]:
|
||||
if hasattr(module, "mode"):
|
||||
mode = getattr(module, "mode")
|
||||
lifecycles[module.name]["mode"] = mode
|
||||
else:
|
||||
lifecycles[module.name]["mode"] = {}
|
||||
|
||||
#else:
|
||||
# lifecycles[module.name]["mode"] = "oneshot"
|
||||
|
||||
if lifecycles[module.name]["mode"] == "continuous":
|
||||
lifecycles[module.name]["refresh_rate"] = module.sleeptime
|
||||
|
||||
if not lifecycles[module.name]["mode"]:
|
||||
if lifecycles[module.name]["mode"] == {}:
|
||||
lifecycles[module.name]["mode"] = "oneshot"
|
||||
|
||||
#lifecycles[module.name][registryname] = registryvalue
|
||||
|
||||
@@ -31,11 +31,14 @@ def buildMonitor(monitor, outputs):
|
||||
buildOutput(response, monitor, outputs)
|
||||
|
||||
if match:
|
||||
from core.execution.executioncontract import executeContract
|
||||
from core.execution.createthread import buildThread
|
||||
#from core.execution.executioncontract import executeContract
|
||||
|
||||
logging.info(filter.get("print"))
|
||||
module = filter["execute"]
|
||||
#module = filter["execute"]
|
||||
|
||||
response = executeContract(filter["execute"], outputs)
|
||||
#response = executeContract(filter["execute"], outputs)
|
||||
|
||||
thread = buildThread(filter["execute"])
|
||||
|
||||
return response
|
||||
Reference in New Issue
Block a user