Some fixes after test

dev-linux
Ivan Maslov 4 years ago
parent 7a6e961aa8
commit 16bdd675b8

@ -1,4 +1,4 @@
cd %~dp0 cd %~dp0
copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\pythonw.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe
.\..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe "AgentSettings.py" .\..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe "AgentSettings.py"
pause >nul pause >nul

@ -14,7 +14,7 @@ if __name__ == "__main__": # New init way
"IsHTTPSBool": False, # True - if server is secured HTTPS, False - if server is not secured HTTP "IsHTTPSBool": False, # True - if server is secured HTTPS, False - if server is not secured HTTP
"HostStr":"127.0.0.1", "HostStr":"127.0.0.1",
"PortInt":80, "PortInt":80,
"SuperTokenStr":"", # Access token to Orchestrator "SuperTokenStr":"1992-04-03-0643-ru-b4ff-openrpa52zzz", # Access token to Orchestrator
}, },
"O2ADict":{ "O2ADict":{
"IsOnlineBool": True, # Parameter can be changed when program executes "IsOnlineBool": True, # Parameter can be changed when program executes

@ -10,17 +10,16 @@ import requests, time
# Send logs to orchestrator # Send logs to orchestrator
def _A2ODataSend(inGSettings, inDataDict): def _A2ODataSend(inGSettings, inDataDict):
lL = inGSettings["Logger"] lL = inGSettings["Logger"]
while inGSettings["A2O"]["IsOnlineBool"]: # Send request to the orchestrator server
# Send request to the orchestrator server try:
try: lProtocolStr= "https" if inGSettings["OrchestratorDict"]["IsHTTPSBool"] else "http"
lProtocolStr= "https" if inGSettings["OrchestratorDict"]["IsHTTPSBool"] else "http" lHostStr = inGSettings["OrchestratorDict"]["HostStr"]
lHostStr = inGSettings["OrchestratorDict"]["HostStr"] lPortInt = inGSettings["OrchestratorDict"]["PortInt"]
lPortInt = inGSettings["OrchestratorDict"]["PortInt"] lURLStr=f"{lProtocolStr}://{lHostStr}:{lPortInt}/pyOpenRPA/Agent/A2O"
lURLStr=f"{lProtocolStr}://{lHostStr}:{lPortInt}/pyOpenRPA/Agent/A2O" lResponse = requests.post(url= lURLStr, cookies = {"AuthToken":inGSettings["OrchestratorDict"]["SuperTokenStr"]}, json=inDataDict)
lResponse = requests.post(url= lURLStr, cookies = {"AuthToken":inGSettings["OrchestratorDict"]["SuperTokenStr"]}, data=inDataDict) except Exception as e:
except Exception as e: if lL: lL.exception(f"A2O Error handler.")
if lL: lL.exception(f"A2O Error handler. Sleep for {inGSettings['A2O']['RetryTimeoutSecFloat']} s.")
time.sleep(inGSettings["A2O"]["RetryTimeoutSecFloat"])
# Send some logs to orchestrator # Send some logs to orchestrator
def LogListSend(inGSettings, inLogList): def LogListSend(inGSettings, inLogList):

@ -9,7 +9,7 @@ import requests, time
def O2A_Loop(inGSettings): def O2A_Loop(inGSettings):
lL = inGSettings["Logger"] lL = inGSettings["Logger"]
while inGSettings["O2A"]["IsOnlineBool"]: while inGSettings["O2ADict"]["IsOnlineBool"]:
# Send request to the orchestrator server # Send request to the orchestrator server
try: try:
lProtocolStr= "https" if inGSettings["OrchestratorDict"]["IsHTTPSBool"] else "http" lProtocolStr= "https" if inGSettings["OrchestratorDict"]["IsHTTPSBool"] else "http"
@ -17,6 +17,10 @@ def O2A_Loop(inGSettings):
lPortInt = inGSettings["OrchestratorDict"]["PortInt"] lPortInt = inGSettings["OrchestratorDict"]["PortInt"]
lURLStr=f"{lProtocolStr}://{lHostStr}:{lPortInt}/pyOpenRPA/Agent/O2A" lURLStr=f"{lProtocolStr}://{lHostStr}:{lPortInt}/pyOpenRPA/Agent/O2A"
lDataDict = { "HostNameUpperStr": inGSettings["AgentDict"]["HostNameUpperStr"], "UserUpperStr": inGSettings["AgentDict"]["UserUpperStr"]} lDataDict = { "HostNameUpperStr": inGSettings["AgentDict"]["HostNameUpperStr"], "UserUpperStr": inGSettings["AgentDict"]["UserUpperStr"]}
lResponse = requests.post(url= lURLStr, cookies = {"AuthToken":inGSettings["OrchestratorDict"]["SuperTokenStr"]}, data=lDataDict) lResponse = requests.post(url= lURLStr, cookies = {"AuthToken":inGSettings["OrchestratorDict"]["SuperTokenStr"]}, json=lDataDict)
if lResponse.status_code != 200:
if lL: lL.warning(f"Agent can not connect to Orchestrator. Below the response from the orchestrator:{lResponse}")
time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"])
except Exception as e: except Exception as e:
time.sleep(inGSettings["O2A"]["RetryTimeoutSecFloat"]) if lL: lL.exception(f"A2O Error handler. Sleep for {inGSettings['A2ODict']['RetryTimeoutSecFloat']} s.")
time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"])

@ -202,6 +202,7 @@ def pyOpenRPA_Agent_A2O(inRequest, inGSettings):
if inRequest.headers.get('Content-Length') is not None: if inRequest.headers.get('Content-Length') is not None:
lInputByteArrayLength = int(inRequest.headers.get('Content-Length')) lInputByteArrayLength = int(inRequest.headers.get('Content-Length'))
lInputByteArray = inRequest.rfile.read(lInputByteArrayLength) lInputByteArray = inRequest.rfile.read(lInputByteArrayLength)
print(lInputByteArray)
# Превращение массива байт в объект # Превращение массива байт в объект
lInput = json.loads(lInputByteArray.decode('utf8')) lInput = json.loads(lInputByteArray.decode('utf8'))
if "LogList" in lInput: if "LogList" in lInput:

Loading…
Cancel
Save