- def UACKeyListCheck(inRequest, inRoleKeyList): #Check is client is has access for the key list

- def WebUserInfoGet(inRequest): # Return User info about request Return {"DomainUpperStr":"", "UserNameUpperStr": ""}
- def WebUserUACHierarchyGet(inRequest): # Return User UAC Hierarchy DICT Return {...}
- Scheduler
- Refactoring in gSettings (Scheduler > SchedulerDict)
- def SchedulerActivityTimeAddWeekly(inGSettings, inTimeHHMMStr="23:55:", inWeekdayList=[], inActivityList=[]): # Add activity in time weekly
- Scheduler now listen SchedulerDict

- def ProcessorActivityItemAppend(inGSettings, inDef, inArgList=[], inArgDict={}, inArgGSettingsStr=None, inArgLoggerStr=None): # Add Activity item in Processor list
dev-linux
Ivan Maslov 4 years ago
parent 09ae47ac85
commit f1f706bca1

@ -48,5 +48,5 @@ def JSInitGenerator():
#Orchestrator settings #Orchestrator settings
def SettingsUpdate(inGSettings): def SettingsUpdate(inGSettings):
# New way to add CP defs in orchestrator - no gSettings.. # New way to add CP defs in orchestrator - no gSettings..
Orchestrator.OrchestratorWebCPUpdate(inGSettings=inGSettings,inCPKeyStr="TEST",inHTMLRenderDef=CPRender, inJSONGeneratorDef=JSONGenerator, inJSInitGeneratorDef=JSInitGenerator) Orchestrator.WebCPUpdate(inGSettings=inGSettings, inCPKeyStr="TEST", inHTMLRenderDef=CPRender, inJSONGeneratorDef=JSONGenerator, inJSInitGeneratorDef=JSInitGenerator)
return inGSettings return inGSettings

@ -42,11 +42,11 @@ if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orc
#lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["VersionCheck"]=True #lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["VersionCheck"]=True
#lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["TEST"]=True #lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["TEST"]=True
#lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]["DESKTOP----;ND"]=True #lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]["DESKTOP----;ND"]=True
Orchestrator.OrchestratorUACUpdate(inGSettings=gSettings, inADLoginStr="ND", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict) Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="ND", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict)
# TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator # TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator
Orchestrator.OrchestratorUACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[]) Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[])
# TEST Add Supertoken for the all access between robots # TEST Add Supertoken for the all access between robots
Orchestrator.OrchestratorUACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz") Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz")
## !!! For Relative import !!! CP Version Check ## !!! For Relative import !!! CP Version Check
sys.path.insert(0,os.path.abspath(os.path.join(r""))) sys.path.insert(0,os.path.abspath(os.path.join(r"")))

@ -389,5 +389,18 @@ def Update(inGSettings):
if "CPDict" not in inGSettings: inGSettings["CPDict"]={} if "CPDict" not in inGSettings: inGSettings["CPDict"]={}
for lItemDict in inGSettings["ControlPanelDict"]["RobotList"]: for lItemDict in inGSettings["ControlPanelDict"]["RobotList"]:
inGSettings["CPDict"][lItemDict["KeyStr"]]={"HTMLRenderDef":lItemDict["RenderFunction"], "JSONGeneratorDef":None, "JSInitGeneratorDef":None} inGSettings["CPDict"][lItemDict["KeyStr"]]={"HTMLRenderDef":lItemDict["RenderFunction"], "JSONGeneratorDef":None, "JSInitGeneratorDef":None}
# Remove old structure ControlPanel # Remove old structure ControlPanel
del inGSettings["ControlPanelDict"] del inGSettings["ControlPanelDict"]
if lL: lL.warning(f"Backward compatibility (v1.1.20 to v1.2.0): Convert ControlPanelDict to CPDict") # Log about compatibility
# Check if Scheduler is active > convert to SchedulerDict
if "Scheduler" in inGSettings:
if "SchedulerDict" not in inGSettings: inGSettings["SchedulerDict"]={ "CheckIntervalSecFloat": 5.0, "ActivityTimeList":[]}
if "ActivityTimeCheckLoopSeconds" in inGSettings["Scheduler"]:
inGSettings["SchedulerDict"]["CheckIntervalSecFloat"] = inGSettings["Scheduler"]["ActivityTimeCheckLoopSeconds"]
for lItemDict in inGSettings["Scheduler"]["ActivityTimeList"]:
lItemDict["ActivityList"]=[v1_2_0_ProcessorOld2NewActivityDict(inActivityOld=lItemDict["Activity"])]
del lItemDict["Activity"]
inGSettings["SchedulerDict"]["ActivityTimeList"].append(lItemDict)
# Remove old structure Scheduler
del inGSettings["Scheduler"]
if lL: lL.warning(f"Backward compatibility (v1.1.20 to v1.2.0): Convert Scheduler to SchedulerDict with new features") # Log about compatibility

@ -161,8 +161,15 @@ def OrchestratorSessionSave(inGSettings=None): ## Orchestrator session save
if lL: lL.info( if lL: lL.info(
f"Orchestrator has dump the RDP list before the restart. The RDP List is {inGSettings['RobotRDPActive']['RDPList']}") f"Orchestrator has dump the RDP list before the restart. The RDP List is {inGSettings['RobotRDPActive']['RDPList']}")
return True return True
#Check is client is has access for the key list
def UACKeyListCheck(inRequest, inRoleKeyList):
return inRequest.UACClientCheck(inRoleKeyList=inRoleKeyList)
# Update user access # Update user access
def OrchestratorUACUpdate(inGSettings, inADLoginStr, inADStr="", inADIsDefaultBool=True, inURLList=[], inCPAllowKeyList=[], inRoleHierarchyAllowedDict={}): def UACUpdate(inGSettings, inADLoginStr, inADStr="", inADIsDefaultBool=True, inURLList=[], inCPAllowKeyList=[], inRoleHierarchyAllowedDict={}):
lUserTurple = (inADStr.upper(),inADLoginStr.upper()) # Create turple key for inGSettings["Server"]["AccessUsers"]["RuleDomainUserDict"] lUserTurple = (inADStr.upper(),inADLoginStr.upper()) # Create turple key for inGSettings["Server"]["AccessUsers"]["RuleDomainUserDict"]
if inURLList==[] and lUserTurple not in inGSettings["Server"]["AccessUsers"]["RuleDomainUserDict"]: # Backward compatibility if user is not exist if inURLList==[] and lUserTurple not in inGSettings["Server"]["AccessUsers"]["RuleDomainUserDict"]: # Backward compatibility if user is not exist
inURLList=[ inURLList=[
@ -198,16 +205,19 @@ def OrchestratorUACUpdate(inGSettings, inADLoginStr, inADStr="", inADIsDefaultBo
inGSettings["Server"]["AccessUsers"]["RuleDomainUserDict"].update({("",inADLoginStr.upper()):lRuleDomainUserDict}) inGSettings["Server"]["AccessUsers"]["RuleDomainUserDict"].update({("",inADLoginStr.upper()):lRuleDomainUserDict})
# Add supertoken for the all access (it is need for the robot communication without human) # Add supertoken for the all access (it is need for the robot communication without human)
def OrchestratorUACSuperTokenUpdate(inGSettings, inSuperTokenStr): def UACSuperTokenUpdate(inGSettings, inSuperTokenStr):
lLoginStr = "SUPERTOKEN" lLoginStr = "SUPERTOKEN"
OrchestratorUACUpdate(inGSettings=inGSettings, inADLoginStr=lLoginStr) UACUpdate(inGSettings=inGSettings, inADLoginStr=lLoginStr)
inGSettings["Server"]["AccessUsers"]["AuthTokensDict"].update( inGSettings["Server"]["AccessUsers"]["AuthTokensDict"].update(
{inSuperTokenStr:{"User":lLoginStr, "Domain":"", "TokenDatetime": datetime.datetime.now(), "FlagDoNotExpire":True}} {inSuperTokenStr:{"User":lLoginStr, "Domain":"", "TokenDatetime": datetime.datetime.now(), "FlagDoNotExpire":True}}
) )
# OrchestratorWEB # # # # # # # # # # # # # # # # # # # # # # #
# OrchestratorWeb defs
# # # # # # # # # # # # # # # # # # # # # # #
# Add control panel HTML, JSON generator or JS when page init # Add control panel HTML, JSON generator or JS when page init
def OrchestratorWebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None): def WebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None):
# Create Struct if the re is current key # Create Struct if the re is current key
if inCPKeyStr not in inGSettings["CPDict"]: if inCPKeyStr not in inGSettings["CPDict"]:
inGSettings["CPDict"][inCPKeyStr] = {"HTMLRenderDef": None,"JSONGeneratorDef": None, "JSInitGeneratorDef": None} inGSettings["CPDict"][inCPKeyStr] = {"HTMLRenderDef": None,"JSONGeneratorDef": None, "JSInitGeneratorDef": None}
@ -221,6 +231,16 @@ def OrchestratorWebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSO
if inJSInitGeneratorDef is not None: if inJSInitGeneratorDef is not None:
inGSettings["CPDict"][inCPKeyStr]["JSInitGeneratorDef"] = inJSInitGeneratorDef inGSettings["CPDict"][inCPKeyStr]["JSInitGeneratorDef"] = inJSInitGeneratorDef
# Return User info about request Return {"DomainUpperStr":"", "UserNameUpperStr": ""}
def WebUserInfoGet(inRequest):
lDomainUpperStr = inRequest.OpenRPA["Domain"].upper()
lUserUpperStr = inRequest.OpenRPA["User"].upper()
return {"DomainUpperStr": lDomainUpperStr, "UserNameUpperStr": lUserUpperStr}
# Return User UAC Hierarchy DICT Return {...}
def WebUserUACHierarchyGet(inRequest):
return inRequest.UserRoleHierarchyGet()
## GSettings defs ## GSettings defs
def GSettingsKeyListValueSet(inGSettings, inValue, inKeyList=[]): # Set value in GSettings by the key list def GSettingsKeyListValueSet(inGSettings, inValue, inKeyList=[]): # Set value in GSettings by the key list
lDict = inGSettings lDict = inGSettings
@ -269,6 +289,19 @@ def GSettingsKeyListValueOperatorPlus(inGSettings, inValue, inKeyList=[]): # Ope
lDict[inKeyList[-1]] += inValue #Set value lDict[inKeyList[-1]] += inValue #Set value
return True return True
# Add Activity item in Processor list
def ProcessorActivityItemAppend(inGSettings, inDef, inArgList=[], inArgDict={}, inArgGSettingsStr=None, inArgLoggerStr=None):
lActivityList=[
{
"Def":inDef, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
"ArgList":inArgList, # Args list
"ArgDict":inArgDict, # Args dictionary
"ArgGSettings": inArgGSettingsStr, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
"ArgLogger": inArgLoggerStr # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
},
]
inGSettings["ProcessorDict"]["ActivityList"]+=lActivityList
## Process defs ## Process defs
def ProcessIsStarted(inProcessNameWOExeStr): # Check if process is started def ProcessIsStarted(inProcessNameWOExeStr): # Check if process is started
''' '''
@ -356,8 +389,22 @@ def PythonStart(inModulePathStr, inDefNameStr, inArgList=[], inArgDict={}, inLog
except Exception as e: except Exception as e:
if inLogger: inLogger.exception("Loop activity error: module/function not founded") if inLogger: inLogger.exception("Loop activity error: module/function not founded")
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Scheduler
# # # # # # # # # # # # # # # # # # # # # # #
# Add activity in time weekly
def SchedulerActivityTimeAddWeekly(inGSettings, inTimeHHMMStr="23:55:", inWeekdayList=[], inActivityList=[]):
lActivityTimeItemDict = {
"TimeHH:MMStr": inTimeHHMMStr, # Time [HH:MM] to trigger activity
"WeekdayList": inWeekdayList, # List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
"ActivityList": inActivityList,
"GUID": None # # Will be filled in Orchestrator automatically - is needed for detect activity completion
},
inGSettings["SchedulerDict"]["ActivityTimeList"].append(lActivityTimeItemDict)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# RDPSession # RDPSession
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@ -698,7 +745,7 @@ def Orchestrator(inGSettings):
if lL: lL.warning(f"RDP Session List was restored from previous Orchestrator session") if lL: lL.warning(f"RDP Session List was restored from previous Orchestrator session")
#Инициализация настроечных параметров #Инициализация настроечных параметров
lDaemonLoopSeconds=gSettingsDict["Scheduler"]["ActivityTimeCheckLoopSeconds"] lDaemonLoopSeconds=gSettingsDict["SchedulerDict"]["CheckIntervalSecFloat"]
lDaemonActivityLogDict={} #Словарь отработанных активностей, ключ - кортеж (<activityType>, <datetime>, <processPath || processName>, <processArgs>) lDaemonActivityLogDict={} #Словарь отработанных активностей, ключ - кортеж (<activityType>, <datetime>, <processPath || processName>, <processArgs>)
lDaemonLastDateTime=datetime.datetime.now() lDaemonLastDateTime=datetime.datetime.now()
gSettingsDict["Server"]["WorkingDirectoryPathStr"] = os.getcwd() # Set working directory in g settings gSettingsDict["Server"]["WorkingDirectoryPathStr"] = os.getcwd() # Set working directory in g settings
@ -762,74 +809,81 @@ def Orchestrator(inGSettings):
gDaemonActivityLogDictRefreshSecInt = 10 # The second period for clear lDaemonActivityLogDict from old items gDaemonActivityLogDictRefreshSecInt = 10 # The second period for clear lDaemonActivityLogDict from old items
gDaemonActivityLogDictLastTime = time.time() # The second perioad for clean lDaemonActivityLogDict from old items gDaemonActivityLogDictLastTime = time.time() # The second perioad for clean lDaemonActivityLogDict from old items
while True: while True:
lCurrentDateTime = datetime.datetime.now() try:
#Циклический обход правил lCurrentDateTime = datetime.datetime.now()
lFlagSearchActivityType=True #Циклический обход правил
# Periodically clear the lDaemonActivityLogDict lFlagSearchActivityType=True
if time.time()-gDaemonActivityLogDictLastTime>=gDaemonActivityLogDictRefreshSecInt: # Periodically clear the lDaemonActivityLogDict
gDaemonActivityLogDictLastTime = time.time() # Update the time if time.time()-gDaemonActivityLogDictLastTime>=gDaemonActivityLogDictRefreshSecInt:
for lIndex, lItem in enumerate(lDaemonActivityLogDict): gDaemonActivityLogDictLastTime = time.time() # Update the time
if lItem["ActivityEndDateTime"] and lCurrentDateTime<=lItem["ActivityEndDateTime"]: for lIndex, lItem in enumerate(lDaemonActivityLogDict):
pass if lItem["ActivityEndDateTime"] and lCurrentDateTime<=lItem["ActivityEndDateTime"]:
# Activity is actual - do not delete now pass
else: # Activity is actual - do not delete now
# remove the activity - not actual else:
lDaemonActivityLogDict.pop(lIndex,None) # remove the activity - not actual
lIterationLastDateTime = lDaemonLastDateTime # Get current datetime before iterator (need for iterate all activities in loop) lDaemonActivityLogDict.pop(lIndex,None)
# Iterate throught the activity list lIterationLastDateTime = lDaemonLastDateTime # Get current datetime before iterator (need for iterate all activities in loop)
for lIndex, lItem in enumerate(gSettingsDict["Scheduler"]["ActivityTimeList"]): # Iterate throught the activity list
# Prepare GUID of the activity for lIndex, lItem in enumerate(gSettingsDict["SchedulerDict"]["ActivityTimeList"]):
lGUID = None try:
if "GUID" in lItem and lItem["GUID"]: # Prepare GUID of the activity
lGUID = lItem["GUID"] lGUID = None
else: if "GUID" in lItem and lItem["GUID"]:
lGUID = str(uuid.uuid4()) lGUID = lItem["GUID"]
lItem["GUID"]=lGUID else:
lGUID = str(uuid.uuid4())
#Проверка дней недели, в рамках которых можно запускать активность lItem["GUID"]=lGUID
lItemWeekdayList=lItem.get("WeekdayList", [0, 1, 2, 3, 4, 5, 6])
if lCurrentDateTime.weekday() in lItemWeekdayList: #Проверка дней недели, в рамках которых можно запускать активность
if lFlagSearchActivityType: lItemWeekdayList=lItem.get("WeekdayList", [0, 1, 2, 3, 4, 5, 6])
####################################################################### if lCurrentDateTime.weekday() in lItemWeekdayList:
#Branch 1 - if has TimeHH:MM if lFlagSearchActivityType:
####################################################################### #######################################################################
if "TimeHH:MM" in lItem: #Branch 1 - if has TimeHH:MM
#Вид активности - запуск процесса #######################################################################
#Сформировать временной штамп, относительно которого надо будет проверять время if "TimeHH:MM" in lItem:
#часовой пояс пока не учитываем #Вид активности - запуск процесса
lActivityDateTime=datetime.datetime.strptime(lItem["TimeHH:MM"],"%H:%M") #Сформировать временной штамп, относительно которого надо будет проверять время
lActivityDateTime=lActivityDateTime.replace(year=lCurrentDateTime.year,month=lCurrentDateTime.month,day=lCurrentDateTime.day) #часовой пояс пока не учитываем
#Убедиться в том, что время наступило lActivityDateTime=datetime.datetime.strptime(lItem["TimeHH:MM"],"%H:%M")
if ( lActivityDateTime=lActivityDateTime.replace(year=lCurrentDateTime.year,month=lCurrentDateTime.month,day=lCurrentDateTime.day)
lActivityDateTime>=lDaemonLastDateTime and #Убедиться в том, что время наступило
lCurrentDateTime>=lActivityDateTime): if (
# Log info about activity lActivityDateTime>=lDaemonLastDateTime and
if lL: lL.info(f"Scheduler:: Activity is started. Scheduler item: {lItem}") #Logging lCurrentDateTime>=lActivityDateTime):
# Do the activity # Log info about activity
Processor.ActivityListOrDict(lItem["Activity"]) if lL: lL.info(f"Scheduler:: Activity list is started in new thread. Scheduler item: {lItem}") #Logging
lIterationLastDateTime = datetime.datetime.now() # Set the new datetime for the new processor activity # Do the activity
####################################################################### lThread = threading.Thread(target=Processor.ActivityListExecute, kwargs={"inGSettings": inGSettings, "inActivityList":lItem["ActivityList"]})
#Branch 2 - if TimeHH:MMStart, TimeHH:MMStop, ActivityIntervalSeconds lThread.start()
####################################################################### lIterationLastDateTime = datetime.datetime.now() # Set the new datetime for the new processor activity
if "TimeHH:MMStart" in lItem and "TimeHH:MMStop" in lItem and "ActivityIntervalSeconds" in lItem: #######################################################################
#Сформировать временной штамп, относительно которого надо будет проверять время #Branch 2 - if TimeHH:MMStart, TimeHH:MMStop, ActivityIntervalSeconds
#часовой пояс пока не учитываем #######################################################################
lActivityDateTime=datetime.datetime.strptime(lItem["TimeHH:MMStart"],"%H:%M") if "TimeHH:MMStart" in lItem and "TimeHH:MMStop" in lItem and "ActivityIntervalSeconds" in lItem:
lActivityDateTime=lActivityDateTime.replace(year=lCurrentDateTime.year,month=lCurrentDateTime.month,day=lCurrentDateTime.day) #Сформировать временной штамп, относительно которого надо будет проверять время
lActivityTimeEndDateTime=datetime.datetime.strptime(lItem["TimeHH:MMStop"],"%H:%M") #часовой пояс пока не учитываем
lActivityTimeEndDateTime=lActivityTimeEndDateTime.replace(year=lCurrentDateTime.year,month=lCurrentDateTime.month,day=lCurrentDateTime.day) lActivityDateTime=datetime.datetime.strptime(lItem["TimeHH:MMStart"],"%H:%M")
#Убедиться в том, что время наступило lActivityDateTime=lActivityDateTime.replace(year=lCurrentDateTime.year,month=lCurrentDateTime.month,day=lCurrentDateTime.day)
if ( lActivityTimeEndDateTime=datetime.datetime.strptime(lItem["TimeHH:MMStop"],"%H:%M")
lCurrentDateTime<lActivityTimeEndDateTime and lActivityTimeEndDateTime=lActivityTimeEndDateTime.replace(year=lCurrentDateTime.year,month=lCurrentDateTime.month,day=lCurrentDateTime.day)
lCurrentDateTime>=lActivityDateTime and #Убедиться в том, что время наступило
(lGUID,lActivityDateTime) not in lDaemonActivityLogDict): if (
#Запись в массив отработанных активностей lCurrentDateTime<lActivityTimeEndDateTime and
lDaemonActivityLogDict[(lGUID,lActivityDateTime)]={"ActivityStartDateTime":lCurrentDateTime, "ActivityEndDateTime":lActivityTimeEndDateTime} lCurrentDateTime>=lActivityDateTime and
#Запуск циклической процедуры (lGUID,lActivityDateTime) not in lDaemonActivityLogDict):
Timer.activityLoopStart(lItem["ActivityIntervalSeconds"], lActivityTimeEndDateTime, lItem["Activity"]) #Запись в массив отработанных активностей
lDaemonLastDateTime = lIterationLastDateTime # Set the new datetime for the new processor activity lDaemonActivityLogDict[(lGUID,lActivityDateTime)]={"ActivityStartDateTime":lCurrentDateTime, "ActivityEndDateTime":lActivityTimeEndDateTime}
#Уснуть до следующего прогона #Запуск циклической процедуры
time.sleep(lDaemonLoopSeconds) Timer.activityLoopStart(lItem["ActivityIntervalSeconds"], lActivityTimeEndDateTime, lItem["Activity"])
except Exception as e:
if lL: lL.exception(f"Scheduler: Exception has been catched in Scheduler module when activity time item was initialising. ActivityTimeItem is {lItem}")
lDaemonLastDateTime = lIterationLastDateTime # Set the new datetime for the new processor activity
#Уснуть до следующего прогона
time.sleep(lDaemonLoopSeconds)
except Exception as e:
if lL: lL.exception(f"Scheduler: Exception has been catched in Scheduler module. Global error")
# Backward compatibility below to 1.2.0 # Backward compatibility below to 1.2.0
def __deprecated_orchestrator_start__(): def __deprecated_orchestrator_start__():

@ -32,33 +32,36 @@ def ProcessorRunSync(inGSettings):
def ActivityListExecute(inGSettings, inActivityList): def ActivityListExecute(inGSettings, inActivityList):
lL = inGSettings["Logger"] # Logger alias lL = inGSettings["Logger"] # Logger alias
lResultList = [] # init the result list lResultList = [] # init the result list
for lActivityItem in inActivityList: # Iterate throught the activity list try:
lDef = None # Def variable for lActivityItem in inActivityList: # Iterate throught the activity list
if callable(lActivityItem["Def"]): # CHeck if def is callable lDef = None # Def variable
lDef = lActivityItem["Def"] # Get the def if callable(lActivityItem["Def"]): # CHeck if def is callable
else: # Is not callable - check alias lDef = lActivityItem["Def"] # Get the def
lDef = inGSettings["ProcessorDict"]["AliasDefDict"].get(lActivityItem["Def"], None) # get def if def key in Alias def storage else: # Is not callable - check alias
#gSettings lDef = inGSettings["ProcessorDict"]["AliasDefDict"].get(lActivityItem["Def"], None) # get def if def key in Alias def storage
lGSettingsDictKey = lActivityItem.pop("ArgGSettings",None) #gSettings
# # Prepare arg dict - gSettings lGSettingsDictKey = lActivityItem.pop("ArgGSettings",None)
if type(lGSettingsDictKey) is str: # check if gSetting key is in ArgDict # # Prepare arg dict - gSettings
lActivityItem["ArgDict"][lGSettingsDictKey] = inGSettings # Set the gSettings in dict if type(lGSettingsDictKey) is str: # check if gSetting key is in ArgDict
# # Prepare arg list lActivityItem["ArgDict"][lGSettingsDictKey] = inGSettings # Set the gSettings in dict
elif type(lGSettingsDictKey) is int: # check if gSetting key is in ArgDict # # Prepare arg list
lActivityItem["ArgList"].insert(lGSettingsDictKey,inGSettings)# Set the gSettings in list by the index elif type(lGSettingsDictKey) is int: # check if gSetting key is in ArgDict
#Logger lActivityItem["ArgList"].insert(lGSettingsDictKey,inGSettings)# Set the gSettings in list by the index
lLoggerDictKey = lActivityItem.pop("ArgLogger",None) #Logger
# # Prepare arg dict - gSettings lLoggerDictKey = lActivityItem.pop("ArgLogger",None)
if type(lLoggerDictKey) is str: # check if gSetting key is in ArgDict # # Prepare arg dict - gSettings
lActivityItem["ArgDict"][lLoggerDictKey] = lL # Set the lLogger in dict if type(lLoggerDictKey) is str: # check if gSetting key is in ArgDict
# # Prepare arg list lActivityItem["ArgDict"][lLoggerDictKey] = lL # Set the lLogger in dict
elif type(lLoggerDictKey) is int: # check if gSetting key is in ArgDict # # Prepare arg list
lActivityItem["ArgList"].insert(lLoggerDictKey,lL)# Set the lLogger in list by the index elif type(lLoggerDictKey) is int: # check if gSetting key is in ArgDict
lActivityItem["ArgList"].insert(lLoggerDictKey,lL)# Set the lLogger in list by the index
try: # try to run function from Processor.py try: # try to run function from Processor.py
lActivityItemResult = lDef(*lActivityItem["ArgList"], **lActivityItem["ArgDict"]) lActivityItemResult = lDef(*lActivityItem["ArgList"], **lActivityItem["ArgDict"])
lResultList.append(lActivityItemResult) # return the result lResultList.append(lActivityItemResult) # return the result
except Exception as e: except Exception as e:
if lL: lL.exception(f"Processor.ActivityListExecute: Exception in def execution - activity will be ignored. Activity item: {lActivityItem}") # Logging if lL: lL.exception(f"Processor.ActivityListExecute: Exception in def execution - activity will be ignored. Activity item: {lActivityItem}") # Logging
lResultList.append(e) # return the generated exception lResultList.append(e) # return the generated exception
except Exception as e:
if lL: lL.exception(f"Processor.ActivityListExecute: Exception when initialisation - All activity list will be ignored. Activity list: {inActivityList}") # Logging
return lResultList # return the result list return lResultList # return the result list

@ -155,50 +155,22 @@ def __Create__():
# }, # },
] ]
}, },
"Scheduler": { "SchedulerDict": {
"ActivityTimeCheckLoopSeconds": 5, # Количество секунд, между циклами проверки действий "CheckIntervalSecFloat": 5.0, # Check interval in seconds
"ActivityTimeList": [ "ActivityTimeList": [
#{ # {
# "TimeHH:MM": "22:23", # Time [HH:MM] to trigger activity # "TimeHH:MMStr": "22:23", # Time [HH:MM] to trigger activity
# "WeekdayList": [1, 2, 3, 4, 5, 6, 7], # "WeekdayList": [0, 1, 2, 3, 4, 5, 6], #List of the weekday index when activity is applicable, Default [0,1,2,3,4,5,6]
# # List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7] # "ActivityList": [
# "Activity": { # {
# "Type": "ProcessStart", # Activity type # "Type": "ProcessStart", # Activity type
# "Path": "start", # Executable file path # "Path": "start", # Executable file path
# "ArgList": ["cmd.exe", "/c", "PIPUpgrade.cmd"] # List of the arguments # "ArgList": ["cmd.exe", "/c", "PIPUpgrade.cmd"] # List of the arguments
# }, # }
# "GUID": None # ],
# # Will be fied in Orchestrator automatically - is needed for detect activity completion # "GUID": None # Will be filled in Orchestrator automatically - is needed for detect activity completion
#}, # },
#{ ],
# "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
# "User": "%username%" # Empty, user or %username%
# },
# "GUID": None
# # Will be fied in Orchestrator automatically - is needed for detect activity completion
#},
#{
# "TimeHH:MMStart": "12:40", # Time [HH:MM] to trigger activity
# "TimeHH:MMStop": "12:40",
# "ActivityIntervalSeconds": 2,
# "WeekdayList": [1, 2, 3, 4, 5, 6, 7],
# # List of the weekday index when activity is applicable, Default [1,2,3,4,5,6,7]
# "Activity": {
# "Type": "ProcessStartIfTurnedOff", # Activity type
# "CheckTaskName": "notepad.exe", # Python function module name
# "Path": "notepad", # Python function name
# "ArgList": [] # Input python function args
# },
# "GUID": None
# # Will be fied in Orchestrator automatically - is needed for detect activity completion
#}
]
}, },
"ProcessorDict": { # Has been changed. New general processor (one threaded) v.1.2.0 "ProcessorDict": { # Has been changed. New general processor (one threaded) v.1.2.0
"ActivityList": [ # List of the activities "ActivityList": [ # List of the activities

@ -28,8 +28,8 @@
- Add front autorefresh if front/back pyOpenRPA versions are differs (see CP_VersionCheck.py) - Add front autorefresh if front/back pyOpenRPA versions are differs (see CP_VersionCheck.py)
- Add absolute/relative import for the control panels - Add absolute/relative import for the control panels
- Add new Orchestrator defs: - Add new Orchestrator defs:
- - def OrchestratorUACUpdate(inGSettings, inADLoginStr, inADStr="", inADIsDefaultBool=True, inURLList=[], inCPAllowKeyList=[]): - Update user access - - def UACUpdate(inGSettings, inADLoginStr, inADStr="", inADIsDefaultBool=True, inURLList=[], inCPAllowKeyList=[]): - Update user access
- - def OrchestratorUACSuperTokenUpdate(inGSettings, inSuperTokenStr): # Add supertoken for the all access (it is need for the robot communication without human) - - def UACSuperTokenUpdate(inGSettings, inSuperTokenStr): # Add supertoken for the all access (it is need for the robot communication without human)
- Create Web HTML / JS generators [pyOpenRPA.Orchestrator.Web.Basic] - Create Web HTML / JS generators [pyOpenRPA.Orchestrator.Web.Basic]
- - def JSEscapeForHTMLInline(inJSStr): # Escape JS to the safe JS for the inline JS in HTML tags ATTENTION! Use it only if want to paste JS into HTML tag - not in <script> - - def JSEscapeForHTMLInline(inJSStr): # Escape JS to the safe JS for the inline JS in HTML tags ATTENTION! Use it only if want to paste JS into HTML tag - not in <script>
- - def HTMLLinkURL(inURLStr, inTitleStr=None, inColorStr=None): # Generate HTML code of the simple URL link by the URL - - def HTMLLinkURL(inURLStr, inTitleStr=None, inColorStr=None): # Generate HTML code of the simple URL link by the URL
@ -79,10 +79,19 @@
- - CPDict > JSONGeneratorDef > def (inGSettings); def (inRequest, inGSettings); def () - - CPDict > JSONGeneratorDef > def (inGSettings); def (inRequest, inGSettings); def ()
- - CPDict > JSInitGeneratorDef > def (inGSettings); def (inRequest, inGSettings); def () - - CPDict > JSInitGeneratorDef > def (inGSettings); def (inRequest, inGSettings); def ()
Orc connect JSONGenerators to WEB Front (mGlobal.) Orc connect JSONGenerators to WEB Front (mGlobal.)
- Orc back: add new block: OrchestratorWeb - Orc back: add new block: Web
- - def OrchestratorWebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None): # Add control panel HTML, JSON generator or JS when page init - - def WebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None): # Add control panel HTML, JSON generator or JS when page init
- Add Working Dir (CWD) + Orchestrator Version Str in ServerData > UserDict - Add Working Dir (CWD) + Orchestrator Version Str in ServerData > UserDict
- Orc Web JS - lite refactoring - Orc Web JS - lite refactoring
- def UACKeyListCheck(inRequest, inRoleKeyList): #Check is client is has access for the key list
- def WebUserInfoGet(inRequest): # Return User info about request Return {"DomainUpperStr":"", "UserNameUpperStr": ""}
- def WebUserUACHierarchyGet(inRequest): # Return User UAC Hierarchy DICT Return {...}
- Scheduler
- Refactoring in gSettings (Scheduler > SchedulerDict)
- def SchedulerActivityTimeAddWeekly(inGSettings, inTimeHHMMStr="23:55:", inWeekdayList=[], inActivityList=[]): # Add activity in time weekly
- Scheduler now listen SchedulerDict
- def ProcessorActivityItemAppend(inGSettings, inDef, inArgList=[], inArgDict={}, inArgGSettingsStr=None, inArgLoggerStr=None): # Add Activity item in Processor list
[1.1.0] [1.1.0]
After 2 month test prefinal with new improovements (+RobotRDPActive in Orchestrator + Easy ControlPanelTemplate) After 2 month test prefinal with new improovements (+RobotRDPActive in Orchestrator + Easy ControlPanelTemplate)
Beta before 1.1.0 (new way of OpenRPA with improvements. Sorry, but no backward compatibility)/ Backward compatibility will start from 1.0.1 Beta before 1.1.0 (new way of OpenRPA with improvements. Sorry, but no backward compatibility)/ Backward compatibility will start from 1.0.1

Loading…
Cancel
Save