#OrchestratorRefactoring NeedTest

Signed-off-by: Ivan Maslov <Ivan.Maslov@UnicodeLabs.ru>
dev-linux
Ivan Maslov 5 years ago
parent 8d434deb3e
commit 89a178de94

4
.gitignore vendored

@ -8,6 +8,7 @@
/**/Sources/build
/**/Sources/dist
/**/Studio/Reports
/**/OpenRPA_Orchestrator.exe
/**/OpenRPAOrchestrator.exe
/**/OpenRPARobotGUIx32.exe
/**/OpenRPARobotGUIx64.exe
@ -15,4 +16,5 @@
/**/OpenRPARobot.exe
/**/breakpoints.lst
/**/Orchestrator/screenshot.png
.idea/**
.idea/**
/**/screenshot.png

@ -1,4 +0,0 @@
cd %~dp0
copy /Y ..\Resources\WPy32-3720\python-3.7.2\python.exe ..\Resources\WPy32-3720\python-3.7.2\OpenRPARobot.exe
.\..\Resources\WPy32-3720\python-3.7.2\OpenRPARobot.exe Robot.py "release"
pause >nul

@ -1,7 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="d710f475-47eb-49e0-9914-2a0070ace3db" name="Default Changelist" comment="" />
<list default="true" id="d710f475-47eb-49e0-9914-2a0070ace3db" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/Orchestrator/__main__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../RobotRun_x32.cmd" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/OpenRPAOrchestratorRun_x64.cmd" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/Orchestrator.py" beforeDir="false" afterPath="$PROJECT_DIR$/Orchestrator/Orchestrator.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/Server.py" beforeDir="false" afterPath="$PROJECT_DIR$/Orchestrator/Server.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/Settings/Settings.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/Settings/Test.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/Settings/__init__.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/Timer.py" beforeDir="false" afterPath="$PROJECT_DIR$/Orchestrator/Timer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Orchestrator/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/Orchestrator/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Robot/__main__.py" beforeDir="false" afterPath="$PROJECT_DIR$/Robot/__main__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../../Utils/PythonDebug_64.cmd" beforeDir="false" afterPath="$PROJECT_DIR$/../../Utils/PythonDebug_64.cmd" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -14,7 +28,12 @@
<component name="ProjectId" id="1TLHWXyRl8l5VGygSuF4LMPAL5y" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../Studio" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/Orchestrator" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Abs\Archive\scopeSrcUL\OpenRPA\Sources\pyOpenRPA\Orchestrator" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">

@ -1,4 +0,0 @@
cd %~dp0
copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\OpenRPAOrchestrator.exe
.\..\Resources\WPy64-3720\python-3.7.2.amd64\OpenRPAOrchestrator.exe Orchestrator.py
pause >nul

@ -5,14 +5,15 @@ import time
import codecs
import os
import signal
import sys #Get input argument
import pdb
import Server
import Timer
import Processor
from . import Server
from . import Timer
from . import Processor
import logging
import copy
from Settings import Settings
#from .Settings import Settings
import importlib
#Создать файл логирования
# add filemode="w" to overwrite
if not os.path.exists("Reports"):
@ -21,7 +22,20 @@ logging.basicConfig(filename="Reports\ReportRun_"+datetime.datetime.now().strfti
#Единый глобальный словарь (За основу взять из Settings.py)
global mGlobalDict
mGlobalDict = Settings.Settings()
#Call Settings function from argv[1] file
################################################
lSubmoduleFunctionName = "Settings"
lFileFullPath = sys.argv[1]
lModuleName = (lFileFullPath.split("\\")[-1])[0:-3]
lTechSpecification = importlib.util.spec_from_file_location(lModuleName, lFileFullPath)
lTechModuleFromSpec = importlib.util.module_from_spec(lTechSpecification)
lTechSpecificationModuleLoader = lTechSpecification.loader.exec_module(lTechModuleFromSpec)
mGlobalDict = None
if lSubmoduleFunctionName in dir(lTechModuleFromSpec):
# Run SettingUpdate function in submodule
mGlobalDict = getattr(lTechModuleFromSpec, lSubmoduleFunctionName)()
#################################################
#mGlobalDict = Settings.Settings(sys.argv[1])
Processor.mGlobalDict = mGlobalDict
Timer.mGlobalDict = mGlobalDict
Timer.Processor.mGlobalDict = mGlobalDict

@ -1,12 +1,13 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
from threading import Thread
import Processor
from . import Processor
import importlib
import pdb
import base64
import uuid
import datetime
import os #for path operations
from http import cookies
from desktopmagic.screengrab_win32 import (
getDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage,
@ -143,30 +144,31 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
AuthenticateBlock(self)
#####################################
else:
lOrchestratorFolder = "\\".join(__file__.split("\\")[:-1])
#Мост между файлом и http запросом (новый формат)
if self.path == "/":
self.SendResponseContentTypeFile('text/html', "Web\\Index.xhtml")
self.SendResponseContentTypeFile('text/html', os.path.join(lOrchestratorFolder, "Web\\Index.xhtml"))
#Мост между файлом и http запросом (новый формат)
if self.path == '/3rdParty/Semantic-UI-CSS-master/semantic.min.css':
self.SendResponseContentTypeFile('text/css',"..\\Resources\\Web\\Semantic-UI-CSS-master\\semantic.min.css")
self.SendResponseContentTypeFile('text/css', os.path.join(lOrchestratorFolder,"..\\Resources\\Web\\Semantic-UI-CSS-master\\semantic.min.css"))
#Мост между файлом и http запросом (новый формат)
if self.path == '/3rdParty/Semantic-UI-CSS-master/semantic.min.js':
self.SendResponseContentTypeFile('application/javascript',"..\\Resources\\Web\\Semantic-UI-CSS-master\\semantic.min.js")
self.SendResponseContentTypeFile('application/javascript', os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\Semantic-UI-CSS-master\\semantic.min.js"))
#Мост между файлом и http запросом (новый формат)
if self.path == '/3rdParty/jQuery/jquery-3.1.1.min.js':
self.SendResponseContentTypeFile('application/javascript',"..\\Resources\\Web\\jQuery\\jquery-3.1.1.min.js")
self.SendResponseContentTypeFile('application/javascript', os.path.join(lOrchestratorFolder,"..\\Resources\\Web\\jQuery\\jquery-3.1.1.min.js"))
#Мост между файлом и http запросом (новый формат)
if self.path == '/3rdParty/Google/LatoItalic.css':
self.SendResponseContentTypeFile('font/css',"..\\Resources\\Web\\Google\\LatoItalic.css")
self.SendResponseContentTypeFile('font/css', os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\Google\\LatoItalic.css"))
#Мост между файлом и http запросом (новый формат)
if self.path == '/3rdParty/Semantic-UI-CSS-master/themes/default/assets/fonts/icons.woff2':
self.SendResponseContentTypeFile('font/woff2',"..\\Resources\\Web\\Semantic-UI-CSS-master\\themes\\default\\assets\\fonts\\icons.woff2")
self.SendResponseContentTypeFile('font/woff2', os.path.join(lOrchestratorFolder,"..\\Resources\\Web\\Semantic-UI-CSS-master\\themes\\default\\assets\\fonts\\icons.woff2"))
#Мост между файлом и http запросом (новый формат)
if self.path == '/favicon.ico':
self.SendResponseContentTypeFile('image/x-icon',"Web\\favicon.ico")
self.SendResponseContentTypeFile('image/x-icon', os.path.join(lOrchestratorFolder, "Web\\favicon.ico"))
#Мост между файлом и http запросом (новый формат)
if self.path == '/3rdParty/Handlebars/handlebars-v4.1.2.js':
self.SendResponseContentTypeFile('application/javascript',"..\\Resources\\Web\\Handlebars\\handlebars-v4.1.2.js")
self.SendResponseContentTypeFile('application/javascript', os.path.join(lOrchestratorFolder,"..\\Resources\\Web\\Handlebars\\handlebars-v4.1.2.js"))
#Получить скриншот
if self.path.split("?")[0] == '/GetScreenshot':
#Сохранить файл на диск
@ -193,18 +195,8 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
lResultJSON={"RenderRobotList":[]}
lRenderFunctionsRobotList=mGlobalDict["ControlPanelDict"]["RobotList"]
for lItem in lRenderFunctionsRobotList:
#Подключить модуль для вызова
#print(globals())
lModuleImportName = lItem.get("RenderFunctionModuleSubfolderName","")
if lModuleImportName!="":
lModuleImportName = f'{lItem["RenderFunctionModuleSubfolderName"]}.{lItem["RenderFunctionModuleName"]}'
else:
lModuleImportName = lItem["RenderFunctionModuleName"]
lModule=importlib.import_module(lModuleImportName)
#Найти функцию
lFunction=getattr(lModule, lItem["RenderFunctionName"])
#Выполнить вызов и записать результат
lItemResultDict=lFunction(mGlobalDict)
lItemResultDict=lItem["RenderFunction"](mGlobalDict)
#RunFunction
lResultJSON["RenderRobotList"].append(lItemResultDict)
# Send message back to client

@ -1,2 +0,0 @@
def SettingsUpdate(inDict):
print("Everything is ok!")

@ -3,7 +3,7 @@ import datetime
import subprocess
import importlib
import logging
import Processor
from . import Processor
global mGlobalDict

@ -0,0 +1,7 @@
r"""
The OpenRPA package (from UnicodeLabs)
"""
__all__ = []
__author__ = 'Ivan Maslov <ivan.maslov@unicodelabs.ru>'

@ -0,0 +1,4 @@
import sys
lFolderPath = "\\".join(__file__.split("\\")[:-2])
sys.path.append(lFolderPath)
from Orchestrator import Orchestrator

@ -4,19 +4,19 @@ __main__ file goes outside the package and used like a main file when the python
"""
#If run as python executable module, need to set python path in pyOpenRPA package to load subpackge
import sys
lFolderPath= "\\".join(__file__.split("\\")[:-1])
lFolderPath = "\\".join(__file__.split("\\")[:-2])
sys.path.append(lFolderPath)
################################
import traceback
from Core import ProcessCommunicator
from Core import JSONNormalize
from Core import UIDesktop
from Robot import ProcessCommunicator
from Robot import JSONNormalize
from Robot import UIDesktop
##########################################
#Run UIDesktop from new process. Communication with paren process by PIPE channel
##########################################
#Определить разрядность процесса
buffer = ""
lJSONInputString=""
lJSONInputString = ""
while True:
#Reset the lProcessResponse
lProcessResponse={"ErrorFlag":False}

@ -136,9 +136,7 @@ def Settings():
"RefreshSeconds": 5,
"RobotList": [
{
"RenderFunctionName": "RenderRobotR01",
"RenderFunctionModuleName": "Settings",
"RenderFunctionModuleSubfolderName": "Settings"
"RenderFunction": RenderRobotR01
}
]
},
@ -161,7 +159,9 @@ def Settings():
import pdb
#lFunction to call in subfiles
lSubmoduleFunctionName = "SettingsUpdate"
lSettingsPath = os.path.join(os.getcwd(), "Settings")
#lSettingsPath = os.path.join(inSettingsFolderPath, "Settings")
lSettingsPath = "\\".join(__file__.split("\\")[:-1])
#lSettingsPath = os.path.join(os.getcwd(), "Settings")
#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 os.path.join(lSettingsPath, f) != __file__]
import importlib.util
@ -171,7 +171,7 @@ def Settings():
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):
if lSubmoduleFunctionName in dir(lTechModuleFromSpec):
#Run SettingUpdate function in submodule
getattr(lTechModuleFromSpec, lSubmoduleFunctionName)(mDict)
return mDict

@ -0,0 +1,2 @@
def SettingsUpdate(inDict):
print("Subsettings file in Settings folder has been sucessfully called")

@ -1,3 +1,3 @@
cd %~dp0
Resources\WPy64-3720\python-3.7.2.amd64\python.exe
..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe
pause >nul

@ -0,0 +1,4 @@
cd %~dp0\..\Sources
copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\OpenRPA_Orchestrator.exe
.\..\Resources\WPy64-3720\python-3.7.2.amd64\OpenRPA_Orchestrator.exe -m pyOpenRPA.Orchestrator "..\Utils\OrchestratorSettings\Settings.py"
pause >nul

@ -0,0 +1,3 @@
cd %~dp0\..\Sources
.\..\Resources\WPy32-3720\python-3.7.2\python.exe -m pyOpenRPA.Robot
pause >nul
Loading…
Cancel
Save