You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Orchestrator/OrchestratorSettings.py

72 lines
3.5 KiB

import psutil, datetime, logging, os, sys # stdout from logging
# Config settings
lPyOpenRPASourceFolderPathStr = r"..\Sources" # Path for test pyOpenRPA package
# Operations
if lPyOpenRPASourceFolderPathStr != "": sys.path.insert(0,os.path.abspath(os.path.join(lPyOpenRPASourceFolderPathStr))) # Path for test pyOpenRPA package
# Start import after config the pyOpenRPA folder
from pyOpenRPA.Orchestrator import SettingsTemplate # Import functionallity
from pyOpenRPA import Orchestrator # Import orchestrator main
#Run as administrator
if not Orchestrator.OrchestratorIsAdmin():
Orchestrator.OrchestratorRerunAsAdmin()
print(f"Orchestrator will be run as administrator!")
elif __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orchestrator
gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration - no more config is available from the box - you can create own
# TEST Add User ND - Add Login ND to superuser of the Orchestrator
lUACClientDict = SettingsTemplate.__UACClientAdminCreate__()
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="ND", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict)
# TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[])
# TEST Add Supertoken for the all access between robots
Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz")
# Add first interface!
Orchestrator.WebListenCreate(inGSettings=gSettings)
# Restore DUMP
Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings)
# INFO Relative/Absolute import see below - after settings init
# Template for import CP - Control Panels
# ATTENTION - Pay attention to CP names! Orchestrator is one for the all control panels per one machine
## !!! For Absolute import control panels !!!
# try:
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# import pyRobot_CP
# pyRobot_CP.SettingsUpdate(inGSettings=gSettings)
# except Exception as e:
# gSettings["Logger"].exception(f"Exception when init CP. See below.")
## !!! For Relative import control panels !!!
# try:
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# from pyRobot_CP import ControlPanel
# ControlPanel.SettingsUpdate(inGSettings=gSettings)
# except Exception as e:
# gSettings["Logger"].exception(f"Exception when init CP. See below.")
## !!! For Relative import !!! CP Version Check
try:
sys.path.insert(0,os.path.abspath(os.path.join(r"")))
from ControlPanel import CP_VersionCheck
CP_VersionCheck.SettingsUpdate(inGSettings=gSettings)
except Exception as e:
gSettings["Logger"].exception(f"Exception when init CP. See below.")
try:
from ControlPanel import CP_Test
CP_Test.SettingsUpdate(inGSettings=gSettings)
except Exception as e:
gSettings["Logger"].exception(f"Exception when init CP. See below.")
# Call the orchestrator def
Orchestrator.Orchestrator(inGSettings=gSettings, inDumpRestoreBool=False)
else:
print("!WARNING! Current orchestrator settings do not support old type of the Orchestrator start. Use new Orchestrator type start (see v1.2.0)")