#Settings files load automatically in Settings (look for SettingsUpdate)

dev-linux
Ivan Maslov 5 years ago
parent 35f761736f
commit 60801e8f8c

@ -93,64 +93,64 @@ def Settings():
},
"Scheduler": {
"ActivityTimeCheckLoopSeconds":5, #Количество секунд, между циклами проверки действий
"ActivityTimeList":[
"ActivityTimeList": [
{
"TimeHH:MM":"19:25", #Time [HH:MM] to trigger activity
"WeekdayList":[1,2,3], #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
"TimeHH:MM": "19:25", #Time [HH:MM] to trigger activity
"WeekdayList": [1,2,3], #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
"Activity":{
"Type":"ProcessStart", #Activity type
"Path":"Notepad", #Executable file path
"Type": "ProcessStart", #Activity type
"Path": "Notepad", #Executable file path
"ArgList": [] #List of the arguments
}
},
{
"TimeHH:MM":"19:20", #Time [HH:MM] to trigger activity
"WeekdayList":[1,2,3], #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
"TimeHH:MM": "19:20", #Time [HH:MM] to trigger activity
"WeekdayList": [1, 2, 3], #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
"Activity":{
"Type":"ProcessStop", #Activity type
"Name":"OpenRPARobotDaemon.exe", #Process name
"FlagForce":True, #Force process close
"Type": "ProcessStop", #Activity type
"Name": "OpenRPARobotDaemon.exe", #Process name
"FlagForce": True, #Force process close
"User": "%username%" #Empty, user or %username%
}
},
{
"TimeHH:MMStart":"19:20", #Time [HH:MM] to trigger activity
"TimeHH:MMStop":"19:20",
"ActivityIntervalSeconds":5,
"WeekdayList":[1,2,3], #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
"TimeHH:MMStart": "19:20", #Time [HH:MM] to trigger activity
"TimeHH:MMStop": "19:20",
"ActivityIntervalSeconds": 5,
"WeekdayList": [1, 2, 3], #List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
"Activity":{
"Type": "PythonStart", #Activity type
"ModuleName": "CheckActivity", #Python function module name
"FunctionName": "test_activity", #Python function name
"ArgList": ["TestArg1","TestArg2"] #Input python function args
"ArgList": ["TestArg1", "TestArg2"] #Input python function args
}
}
],
"LogList":[]
"LogList": []
},
"Processor":{
"LogType_CMDStart":True, #LogType_<Type>: <bool> if Trace for command is selected for False, the tracing will be off for such activity type. Default True
"LogList":[] #List of processor activity, which was executed. Fill list when orchestrator is running
"Processor": {
"LogType_CMDStart": True, #LogType_<Type>: <bool> if Trace for command is selected for False, the tracing will be off for such activity type. Default True
"LogList": [] #List of processor activity, which was executed. Fill list when orchestrator is running
},
"ControlPanelDict":{
"ControlPanelDict": {
"RefreshSeconds": 5,
"RobotList": [
{
"RenderFunctionName":"RenderRobotR01",
"RenderFunctionModuleName":"Settings",
"RenderFunctionModuleSubfolderName":"Settings"
"RenderFunctionName": "RenderRobotR01",
"RenderFunctionModuleName": "Settings",
"RenderFunctionModuleSubfolderName": "Settings"
}
]
},
"FileManager": {
"FileURLFilePathDict_help":"https://localhost:8081/filemanager/<file URL>. All FileURL s must be set in lowercase",
"FileURLFilePathDict":{
"r01/report.xlsx":"C:\\RPA\\R01_IntegrationOrderOut\\Data\\Reestr_otgruzok.xlsx"
"FileURLFilePathDict_help": "https://localhost:8081/filemanager/<file URL>. All FileURL s must be set in lowercase",
"FileURLFilePathDict": {
"r01/report.xlsx": "C:\\RPA\\R01_IntegrationOrderOut\\Data\\Reestr_otgruzok.xlsx"
}
},
"Storage":{
"Robot_R01_help":"Robot data storage in orchestrator env",
"Robot_R01":{}
"Storage": {
"Robot_R01_help": "Robot data storage in orchestrator env",
"Robot_R01": {}
}
}
###################################
@ -159,16 +159,19 @@ def Settings():
#Get file list from Settings folder
import os
import pdb
#lFunction to call in subfiles
lSubmoduleFunctionName = "SettingsUpdate"
lSettingsPath = os.path.join(os.getcwd(), "Settings")
#pdb.set_trace()
#Lambda function to get files .py from settings folder except Settings.py
lFileList = [f for f in os.listdir(lSettingsPath) if os.path.isfile(os.path.join(lSettingsPath, f)) and f.split(".")[-1]=="py" and f != "Settings.py"]
#TODO Import files as python module and call SettingsUpdate()
lFileList = [f for f in os.listdir(lSettingsPath) if os.path.isfile(os.path.join(lSettingsPath, f)) and f.split(".")[-1] == "py" and os.path.join(lSettingsPath, f) != __file__]
import importlib.util
for lModuleFilePathItem in lFileList
spec = importlib.util.spec_from_file_location("module.name", "/path/to/file.py")
foo = importlib.util.module_from_spec(spec)
#spec.loader.exec_module(foo)
#foo.MyClass()
#Return Global settings
for lModuleFilePathItem in lFileList:
lModuleName = lModuleFilePathItem[0:-3]
lFileFullPath = os.path.join(lSettingsPath, lModuleFilePathItem)
lTechSpecification = importlib.util.spec_from_file_location(lModuleName, lFileFullPath)
lTechModuleFromSpec = importlib.util.module_from_spec(lTechSpecification)
lTechSpecificationModuleLoader = lTechSpecification.loader.exec_module(lTechModuleFromSpec)
if "SettingsUpdate" in dir(lTechModuleFromSpec):
#Run SettingUpdate function in submodule
getattr(lTechModuleFromSpec, lSubmoduleFunctionName)(mDict)
return mDict

@ -1,2 +1,2 @@
def SettingsUpdate():
def SettingsUpdate(inDict):
print("Everything is ok!")
Loading…
Cancel
Save