|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import requests, time
|
|
|
|
|
import requests, time, json
|
|
|
|
|
# O2A - Data flow Orchestrator to Agent
|
|
|
|
|
|
|
|
|
|
# f"{lProtocolStr}://{lHostStr}:{lPortInt}/pyOpenRPA/Agent/O2A"
|
|
|
|
@ -19,6 +19,7 @@ def O2A_Loop(inGSettings):
|
|
|
|
|
lActivityLastGUIDStr = "" # Init empty ActivityLastGUIDStr
|
|
|
|
|
while inGSettings["O2ADict"]["IsOnlineBool"]:
|
|
|
|
|
# Send request to the orchestrator server
|
|
|
|
|
lRequestBody = None
|
|
|
|
|
try:
|
|
|
|
|
lProtocolStr= "https" if inGSettings["OrchestratorDict"]["IsHTTPSBool"] else "http"
|
|
|
|
|
lHostStr = inGSettings["OrchestratorDict"]["HostStr"]
|
|
|
|
@ -30,6 +31,7 @@ def O2A_Loop(inGSettings):
|
|
|
|
|
if lL: lL.warning(f"Agent can not connect to Orchestrator. Below the response from the orchestrator:{lResponse}")
|
|
|
|
|
time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"])
|
|
|
|
|
else:
|
|
|
|
|
lRequestBody = lResponse.text
|
|
|
|
|
lQueueItem = lResponse.json() # Try to get JSON
|
|
|
|
|
# Append QUEUE item in ProcessorDict > ActivityList
|
|
|
|
|
lActivityLastGUIDStr = lQueueItem["GUIDStr"]
|
|
|
|
@ -43,4 +45,8 @@ def O2A_Loop(inGSettings):
|
|
|
|
|
time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"])
|
|
|
|
|
except ConnectionResetError as e:
|
|
|
|
|
if lL: lL.error(f"O2A Connection error - orchestrator is not available. Sleep for {inGSettings['A2ODict']['RetryTimeoutSecFloat']} s.")
|
|
|
|
|
time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"])
|
|
|
|
|
except json.decoder.JSONDecodeError as e:
|
|
|
|
|
if lL: lL.error(
|
|
|
|
|
f"See body of the recieved content from the Orchestrator: {lRequestBody}")
|
|
|
|
|
time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"])
|