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

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