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