|
|
|
@ -325,16 +325,18 @@ def pyOpenRPA_ActivityListExecute(inRequest:Request, inAuthTokenStr:str = Depend
|
|
|
|
|
#inRequest.OpenRPAResponseDict["Body"] = bytes(json.dumps(lResultList[0]), "utf8")
|
|
|
|
|
|
|
|
|
|
# See docs in Agent (pyOpenRPA.Agent.O2A)
|
|
|
|
|
def pyOpenRPA_Agent_O2A(inRequest, inGSettings):
|
|
|
|
|
lL = inGSettings["Logger"] # Alias
|
|
|
|
|
@app.post(path="/orpa/agent/o2a",response_class=JSONResponse,tags=["Agent"])
|
|
|
|
|
def pyOpenRPA_Agent_O2A(inRequest:Request, inAuthTokenStr:str = Depends(IdentifyAuthorize), inBodyDict = Body({})):
|
|
|
|
|
inGSettings = __Orchestrator__.GSettingsGet()
|
|
|
|
|
lL = __Orchestrator__.OrchestratorLoggerGet()
|
|
|
|
|
lConnectionLifetimeSecFloat = inGSettings["ServerDict"]["AgentConnectionLifetimeSecFloat"] # 300.0 # 5 min * 60 sec 300.0
|
|
|
|
|
lActivityItemLifetimeLimitSecFloat = inGSettings["ServerDict"]["AgentActivityLifetimeSecFloat"]
|
|
|
|
|
lAgentLoopSleepSecFloat = inGSettings["ServerDict"]["AgentLoopSleepSecFloat"]
|
|
|
|
|
lTimeStartFloat = time.time()
|
|
|
|
|
# Recieve the data
|
|
|
|
|
lValueStr = inRequest.body
|
|
|
|
|
#lValueStr = inBodyDict
|
|
|
|
|
# Превращение массива байт в объект
|
|
|
|
|
lInput = json.loads(lInputByteArray.decode('utf8'))
|
|
|
|
|
lInput = inBodyDict#json.loads(lValueStr)
|
|
|
|
|
# Check if item is created
|
|
|
|
|
lAgentDictItemKeyTurple = (lInput["HostNameUpperStr"],lInput["UserUpperStr"])
|
|
|
|
|
if lAgentDictItemKeyTurple not in inGSettings["AgentDict"]:
|
|
|
|
@ -385,12 +387,12 @@ def pyOpenRPA_Agent_O2A(inRequest, inGSettings):
|
|
|
|
|
for lItemDict in lReturnActivityItemList:
|
|
|
|
|
if "CreatedByDatetime" in lItemDict:
|
|
|
|
|
del lItemDict["CreatedByDatetime"]
|
|
|
|
|
inRequest.OpenRPAResponseDict["Body"] = bytes(json.dumps(lReturnActivityItemList), "utf8")
|
|
|
|
|
# Log full version if bytes size is less than limit . else short
|
|
|
|
|
lBodyLenInt = len(inRequest.OpenRPAResponseDict["Body"])
|
|
|
|
|
lBodyLenInt = len(lReturnActivityItemList)
|
|
|
|
|
lAgentLimitLogSizeBytesInt = inGSettings["ServerDict"]["AgentLimitLogSizeBytesInt"]
|
|
|
|
|
if lL: lL.debug(f"ActivityItem to Agent ({lInput['HostNameUpperStr']}, {lInput['UserUpperStr']}): Item count: {len(lReturnActivityItemList)}, bytes size: {lBodyLenInt}")
|
|
|
|
|
lDoLoopBool = False # CLose the connection
|
|
|
|
|
lThisAgentDict["ConnectionCountInt"] -= 1 # Connection go to be closed - decrement the connection count
|
|
|
|
|
return lReturnActivityItemList
|
|
|
|
|
else: # Nothing to send - sleep for the next iteration
|
|
|
|
|
time.sleep(lAgentLoopSleepSecFloat)
|
|
|
|
|
else: # no queue item - sleep for the next iteration
|
|
|
|
@ -427,12 +429,14 @@ def pyOpenRPA_Debugging_HelperDefAutofill(inRequest:Request, inAuthTokenStr:str
|
|
|
|
|
return lResultDict
|
|
|
|
|
|
|
|
|
|
# See docs in Agent (pyOpenRPA.Agent.A2O)
|
|
|
|
|
def pyOpenRPA_Agent_A2O(inRequest, inGSettings):
|
|
|
|
|
lL = inGSettings["Logger"]
|
|
|
|
|
@app.post(path="/orpa/agent/a2o",response_class=JSONResponse,tags=["Agent"])
|
|
|
|
|
def pyOpenRPA_Agent_A2O(inRequest:Request, inAuthTokenStr:str = Depends(IdentifyAuthorize), inBodyDict = Body({})):
|
|
|
|
|
inGSettings = __Orchestrator__.GSettingsGet()
|
|
|
|
|
lL = __Orchestrator__.OrchestratorLoggerGet()
|
|
|
|
|
# Recieve the data
|
|
|
|
|
lValueStr = inRequest.body
|
|
|
|
|
#lValueStr = inBodyStr
|
|
|
|
|
# Превращение массива байт в объект
|
|
|
|
|
lInput = json.loads(lValueStr)
|
|
|
|
|
lInput = inBodyDict#json.loads(lValueStr)
|
|
|
|
|
lAgentDictItemKeyTurple = (lInput["HostNameUpperStr"], lInput["UserUpperStr"])
|
|
|
|
|
if "LogList" in lInput:
|
|
|
|
|
for lLogItemStr in lInput["LogList"]:
|
|
|
|
@ -518,8 +522,8 @@ def SettingsUpdate():
|
|
|
|
|
#{"Method": "GET", "URL": "/orpa/api/helper-def-list/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefList, "ResponseContentType": "application/json"},
|
|
|
|
|
#{"Method": "GET", "URL": "/orpa/api/helper-def-autofill/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefAutofill, "ResponseContentType": "application/json"},
|
|
|
|
|
# AGENT
|
|
|
|
|
{"Method": "POST", "URL": "/orpa/agent/o2a", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_O2A, "ResponseContentType": "application/json"},
|
|
|
|
|
{"Method": "POST", "URL": "/orpa/agent/a2o", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_A2O, "ResponseContentType": "application/json"}
|
|
|
|
|
#{"Method": "POST", "URL": "/orpa/agent/o2a", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_O2A, "ResponseContentType": "application/json"},
|
|
|
|
|
#{"Method": "POST", "URL": "/orpa/agent/a2o", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_A2O, "ResponseContentType": "application/json"}
|
|
|
|
|
]
|
|
|
|
|
Usage.Process(inComponentStr="Orchestrator")
|
|
|
|
|
gSettingsDict["ServerDict"]["URLList"]=gSettingsDict["ServerDict"]["URLList"]+lURLList
|
|
|
|
|