def ActivityItemDefAliasModulesLoad - load full python scode from sys.modules in ActivityItem def alias. run when Orchestrator starts

dev-linux
Ivan Maslov 3 years ago
parent a07784e818
commit a41a0a0462

@ -1332,6 +1332,22 @@ def ActivityItemDefAliasCreate(inDef, inAliasStr=None, inGSettings = None):
inGSettings["ProcessorDict"]["AliasDefDict"][inAliasStr] = inDef inGSettings["ProcessorDict"]["AliasDefDict"][inAliasStr] = inDef
return inAliasStr return inAliasStr
def ActivityItemDefAliasModulesLoad():
"""
Load all def from sys.modules... in ActivityItem def alias dict
:return: None
"""
lL = OrchestratorLoggerGet()
lL.info(f"ActivityItem aliases: start to load sys.modules")
for lModuleItemStr in sys.modules:
lModuleItem = sys.modules[lModuleItemStr]
for lDefItemStr in dir(lModuleItem):
lDefItem = getattr(lModuleItem,lDefItemStr)
if callable(lDefItem) and not lDefItemStr.startswith("_"):
ActivityItemDefAliasCreate(inDef=lDefItem, inAliasStr=f"{lModuleItemStr}.{lDefItemStr}")
lL.info(f"ActivityItem aliases: finish to load sys.modules")
def ActivityItemDefAliasUpdate(inDef, inAliasStr, inGSettings = None): def ActivityItemDefAliasUpdate(inDef, inAliasStr, inGSettings = None):
""" """
Update alias for def (can be used in ActivityItem in field Def). Update alias for def (can be used in ActivityItem in field Def).
@ -2541,6 +2557,9 @@ def Orchestrator(inGSettings=None, inDumpRestoreBool = True, inRunAsAdministrato
lItemDef = getattr(lModule,lItemDefNameStr) lItemDef = getattr(lModule,lItemDefNameStr)
if callable(lItemDef): inGSettings["ProcessorDict"]["AliasDefDict"][lItemDefNameStr]=lItemDef if callable(lItemDef): inGSettings["ProcessorDict"]["AliasDefDict"][lItemDefNameStr]=lItemDef
#Load all defs from sys.modules
ActivityItemDefAliasModulesLoad()
#Инициализация настроечных параметров #Инициализация настроечных параметров
lDaemonLoopSeconds=gSettingsDict["SchedulerDict"]["CheckIntervalSecFloat"] lDaemonLoopSeconds=gSettingsDict["SchedulerDict"]["CheckIntervalSecFloat"]
lDaemonActivityLogDict={} #Словарь отработанных активностей, ключ - кортеж (<activityType>, <datetime>, <processPath || processName>, <processArgs>) lDaemonActivityLogDict={} #Словарь отработанных активностей, ключ - кортеж (<activityType>, <datetime>, <processPath || processName>, <processArgs>)

Loading…
Cancel
Save