|
|
@ -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"])
|