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/Wiki/ENG_Guide/markdown/Orchestrator/HowToStart.md

3.6 KiB

How to start

Start configuration example

import psutil, datetime, logging, os, sys # stdout from logging

# Config settings
lPyOpenRPASourceFolderPathStr = r"..\Sources" # Path for test pyOpenRPA package

# 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 !!!
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# import pyRobot_CP
# pyRobot_CP.SettingsUpdate(inGSettings=gSettings)

## !!! For Relative import !!!
# sys.path.insert(0,os.path.abspath(os.path.join(r"..\ROBOT\Builds")))
# from pyRobot_CP import ControlPanel
# ControlPanel.SettingsUpdate(inGSettings=gSettings)

# 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


if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orchestrator
    from pyOpenRPA import Orchestrator  # Import orchestrator main
    gSettings = SettingsTemplate.Create(inModeStr="BASIC") # Create GSettings with basic configuration

    # TEST Add User ND - Add Login ND to superuser of the Orchestrator
    lUACClientDict = SettingsTemplate.__UACClientAdminCreate__()
    # del lUACClientDict["pyOpenRPADict"]["AdminDict"]["LogViewerBool"]
    # del lUACClientDict["pyOpenRPADict"]["AdminDict"]["CMDInputBool"]
    # del lUACClientDict["pyOpenRPADict"]["AdminDict"]["ScreenshotViewerBool"]
    # del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartOrchestratorBool"]
    # del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartOrchestratorGITPullBool"]
    # del lUACClientDict["pyOpenRPADict"]["AdminDict"]["RestartPCBool"]
    # del lUACClientDict["pyOpenRPADict"]["RDPKeyDict"]
    # del lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]
    # del lUACClientDict["pyOpenRPADict"]["CPKeyDict"]
    #lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["VersionCheck"]=True
    #lUACClientDict["pyOpenRPADict"]["CPKeyDict"]["TEST"]=True
    #lUACClientDict["pyOpenRPADict"]["AgentKeyDict"]["DESKTOP----;ND"]=True
    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")

    ## !!! 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)

else:
    print("!WARNING! Current orchestrator settings do not support old type of the Orchestrator start. Use new Orchestrator type start (see v1.2.0)")