# Minor fixes in RobotRDPActive # RobotRDPActive SpeedUp

dev-linux
Ivan Maslov 4 years ago
parent cd8f6bb64c
commit c4f835b3cf

@ -17,6 +17,16 @@ def RenderRobotRDPActive(inGlobalConfiguration):
lOnClickSafeTurnOff = "mGlobal.Processor.ServerValueSet(['Storage','RobotRDPActive','OrchestratorToRobotResetStorage','SafeTurnOff'],true);"
#Force close button
lOnClickForceCloseButton=f"mGlobal.Controller.CMDRunText('taskkill /F /im {lProcessName}');"
# # # # # Add recieve file activity
lTestRecieveActivityList = [
{
"ModulePath": f"{os.path.join(lRobotRDPActiveFolderPath,'Defs_SessionIndex.py')}", # "Session\\SessionDefs.py"
"DefName":"FileStoredRecieve", # Function name
"ArgList":[], # Args list
"ArgDict":{"inSessionIndex": 0, "inHostFilePath": "testRecieve.txt","inRDPFilePath": "C:\\Temp\\testRecieve.txt"} # Args dictionary
}
]
lOnClickTestSendBaumanStr = f"mGlobal.Processor.ServerValueSet(['Storage','RobotRDPActive','OrchestratorToRobotResetStorage','ActivityList'],{json.dumps(lTestRecieveActivityList)});"
#Result template
lResultDict={
"HeaderLeftText":"Keep active RDP sessions",
@ -63,7 +73,7 @@ def RenderRobotRDPActive(inGlobalConfiguration):
################################
#Session state
lItemSessionState='<span style=\"color:red\">Disconnected</span>'
if lItem.get("SessionIsWindowExistBool",False):
if lItem.get("SessionIsWindowResponsibleBool",False):
lItemSessionState='<span style=\"color:green\">Connected</span>'
lResultDict["BodyKeyValueList"].append({"Key":f"[{str(lRDPListIndex)}]{lLabelSessionFullScreen}{lLabelIsIgnored}{lItem.get('Host','localhost')}:{lItem.get('Port','--')}","Value":f"{lItem.get('Login','--')}, {lItem.get('SessionHex','--')}, State {lItemSessionState}, {lSetFullScreenA}, {lIgnoreIndexListLink}"})
lRDPListIndex = lRDPListIndex + 1

@ -383,6 +383,13 @@ def IntervalDataReceiveResetAsync(*args,**kwargs):
if "Interval" in lKwargs:
lInterval = lKwargs["Interval"]
del lKwargs["Interval"]
# Reset the storage before start
DataSendSync(
RobotValue=lKwargs["RobotResetValue"],
OrchestratorKeyList=lKwargs["OrchestratorKeyList"], OrchestratorProtocol=lKwargs["OrchestratorProtocol"],
OrchestratorHost=lKwargs["OrchestratorHost"], OrchestratorPort=lKwargs["OrchestratorPort"],
OrchestratorAuthToken=lKwargs["OrchestratorAuthToken"]
)
lTimer = TimerRepeat.TimerRepeat(lInterval, DataReceiveResetAsync, lArgs, lKwargs)
lTimer.start()
#Add timer to general list to stop this when needed

@ -17,8 +17,10 @@ def FileStoredSend(inHostFilePath, inRDPFilePath):
lHostFileAbsPath = os.path.join("\\\\tsclient", os.path.abspath(inHostFilePath).replace(":","")) # \\tsclient\C\path\to\file
lHostRDPFileAbsPath = os.path.abspath(inRDPFilePath) # File location in RDP
lResult = f'copy /Y "{lHostFileAbsPath}" "{lHostRDPFileAbsPath}"'
return lResult
# Send file from Session RDP to Host using shared drive in RDP (force copy)
def FileStoredRecieve(inRDPFilePath, inHostFilePath):
lHostFileAbsPath = os.path.join("\\\\tsclient", os.path.abspath(inHostFilePath).replace(":","")) # \\tsclient\C\path\to\file
lHostRDPFileAbsPath = os.path.abspath(inRDPFilePath) # File location in RDP
lResult = f'copy /Y "{lHostRDPFileAbsPath}" "{lHostFileAbsPath}"'
lResult = f'copy /Y "{lHostRDPFileAbsPath}" "{lHostFileAbsPath}"'
return lResult

@ -142,6 +142,7 @@ def SessionRDPStart(inRDPFilePath):
time.sleep(3)
# set the fullscreen
SessionScreenFull(inSessionHex=lRDPFileName)
time.sleep(1)
# Check RDP responsibility
lDoCheckResponsibilityBool = True
lDoCheckResponsibilityCountMax = 20
@ -198,14 +199,14 @@ def SessionClose(inSessionHexStr):
# "IsResponsibleBool": True|False # Flag is RDP is responsible - works only when inModeStr = CROSSCHECK
# }
# example Connector.SessionCMDRun("4d1e48f3ff6c45cc810ea25d8adbeb50","start notepad", "RUN")
def SessionCMDRun(inSessionHex,inCMDCommandStr = "echo 1", inModeStr="CROSSCHECK"):
def SessionCMDRun(inSessionHex,inCMDCommandStr = "echo 1", inModeStr="CROSSCHECK", inClipboardTimeoutSec = 5):
# Init the result dict
lResult = {"OutStr": None,"IsResponsibleBool":True}
# Enter full screen mode
SessionScreenFull(inSessionHex)
time.sleep(2)
# Run CMD operations
lResult = SystemCMDRun(inCMDCommandStr = inCMDCommandStr, inModeStr = inModeStr)
lResult = SystemCMDRun(inCMDCommandStr = inCMDCommandStr, inModeStr = inModeStr, inClipboardTimeoutSec = inClipboardTimeoutSec)
# Exit fullscreen mode
SessionScreen100x550(inSessionHex)
# Check if session is in Full screen mode

@ -5,6 +5,7 @@ import time # Time wait operations
import pdb
import importlib # from dynamic import module
from . import ConnectorExceptions # Exceptions classes
import copy
#Check for session is closed. Reopen if detected. Always keep session is active
def Monitor(inGlobalDict, inListUpdateTimeout):
lFlagWhile = True
@ -120,7 +121,9 @@ def Monitor(inGlobalDict, inListUpdateTimeout):
####################################
# Check ActivityList from orchestrator
lActivityListNew = []
for lActivityItem in inGlobalDict["OrchestratorToRobotResetStorage"]["ActivityList"]:
lActivityListOld = inGlobalDict["OrchestratorToRobotResetStorage"]["ActivityList"]+inGlobalDict["ActivityListStart"]
inGlobalDict["ActivityListStart"] = []
for lActivityItem in lActivityListOld:
#################
#Call function from Activity structure
################################################
@ -150,6 +153,6 @@ def Monitor(inGlobalDict, inListUpdateTimeout):
inGlobalDict["Logger"].warning(f"Host session has lost the GUI")
finally:
# Wait for the next iteration
time.sleep(2)
time.sleep(0.7)
return None
#TODO Def garbage window cleaner (if connection was lost)

@ -99,7 +99,7 @@ def Settings():
mDict["OrchestratorConnector"]={
"IntervalDataSendAsync": [
{
"Interval": 2.7,
"Interval": 1.1,
"RobotStorage": mDict,
"RobotStorageKey": "RDPList",
"OrchestratorKeyList": ["Storage", "RobotRDPActive","RobotToOrchestratorStorage","RDPList"],
@ -109,7 +109,7 @@ def Settings():
"OrchestratorAuthToken": lOrchestratorAuthToken
},
{
"Interval": 2.7,
"Interval": 1,
"RobotStorage": mDict,
"RobotStorageKey": "RDPList",
"OrchestratorKeyList": ["Storage", "RobotRDPActive","RobotToOrchestratorStorage","FullScreenSessionIndex"],
@ -121,7 +121,7 @@ def Settings():
],
"IntervalDataReceiveResetAsync": [
{
"Interval": 3.3,
"Interval": 1.05,
"RobotStorage": mDict,
"RobotStorageKey": "OrchestratorToRobotResetStorage",
"RobotResetValue": mDict["OrchestratorToRobotResetStorage"],
@ -134,7 +134,7 @@ def Settings():
],
"IntervalDataReceiveAsync": [
{
"Interval": 1.5,
"Interval": 1.25,
"RobotStorage": mDict,
"RobotStorageKey": "OrchestratorToRobotStorage",
"OrchestratorKeyList": ["Storage", "RobotRDPActive","OrchestratorToRobotStorage"],

Loading…
Cancel
Save