# Minor fixes in RobotRDPActive # RobotRDPActive SpeedUp

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

@ -17,6 +17,16 @@ def RenderRobotRDPActive(inGlobalConfiguration):
lOnClickSafeTurnOff = "mGlobal.Processor.ServerValueSet(['Storage','RobotRDPActive','OrchestratorToRobotResetStorage','SafeTurnOff'],true);" lOnClickSafeTurnOff = "mGlobal.Processor.ServerValueSet(['Storage','RobotRDPActive','OrchestratorToRobotResetStorage','SafeTurnOff'],true);"
#Force close button #Force close button
lOnClickForceCloseButton=f"mGlobal.Controller.CMDRunText('taskkill /F /im {lProcessName}');" 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 #Result template
lResultDict={ lResultDict={
"HeaderLeftText":"Keep active RDP sessions", "HeaderLeftText":"Keep active RDP sessions",
@ -63,7 +73,7 @@ def RenderRobotRDPActive(inGlobalConfiguration):
################################ ################################
#Session state #Session state
lItemSessionState='<span style=\"color:red\">Disconnected</span>' lItemSessionState='<span style=\"color:red\">Disconnected</span>'
if lItem.get("SessionIsWindowExistBool",False): if lItem.get("SessionIsWindowResponsibleBool",False):
lItemSessionState='<span style=\"color:green\">Connected</span>' 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}"}) 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 lRDPListIndex = lRDPListIndex + 1

@ -383,6 +383,13 @@ def IntervalDataReceiveResetAsync(*args,**kwargs):
if "Interval" in lKwargs: if "Interval" in lKwargs:
lInterval = lKwargs["Interval"] lInterval = lKwargs["Interval"]
del 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 = TimerRepeat.TimerRepeat(lInterval, DataReceiveResetAsync, lArgs, lKwargs)
lTimer.start() lTimer.start()
#Add timer to general list to stop this when needed #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 lHostFileAbsPath = os.path.join("\\\\tsclient", os.path.abspath(inHostFilePath).replace(":","")) # \\tsclient\C\path\to\file
lHostRDPFileAbsPath = os.path.abspath(inRDPFilePath) # File location in RDP lHostRDPFileAbsPath = os.path.abspath(inRDPFilePath) # File location in RDP
lResult = f'copy /Y "{lHostFileAbsPath}" "{lHostRDPFileAbsPath}"' lResult = f'copy /Y "{lHostFileAbsPath}" "{lHostRDPFileAbsPath}"'
return lResult
# Send file from Session RDP to Host using shared drive in RDP (force copy) # Send file from Session RDP to Host using shared drive in RDP (force copy)
def FileStoredRecieve(inRDPFilePath, inHostFilePath): def FileStoredRecieve(inRDPFilePath, inHostFilePath):
lHostFileAbsPath = os.path.join("\\\\tsclient", os.path.abspath(inHostFilePath).replace(":","")) # \\tsclient\C\path\to\file lHostFileAbsPath = os.path.join("\\\\tsclient", os.path.abspath(inHostFilePath).replace(":","")) # \\tsclient\C\path\to\file
lHostRDPFileAbsPath = os.path.abspath(inRDPFilePath) # File location in RDP 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) time.sleep(3)
# set the fullscreen # set the fullscreen
SessionScreenFull(inSessionHex=lRDPFileName) SessionScreenFull(inSessionHex=lRDPFileName)
time.sleep(1)
# Check RDP responsibility # Check RDP responsibility
lDoCheckResponsibilityBool = True lDoCheckResponsibilityBool = True
lDoCheckResponsibilityCountMax = 20 lDoCheckResponsibilityCountMax = 20
@ -198,14 +199,14 @@ def SessionClose(inSessionHexStr):
# "IsResponsibleBool": True|False # Flag is RDP is responsible - works only when inModeStr = CROSSCHECK # "IsResponsibleBool": True|False # Flag is RDP is responsible - works only when inModeStr = CROSSCHECK
# } # }
# example Connector.SessionCMDRun("4d1e48f3ff6c45cc810ea25d8adbeb50","start notepad", "RUN") # 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 # Init the result dict
lResult = {"OutStr": None,"IsResponsibleBool":True} lResult = {"OutStr": None,"IsResponsibleBool":True}
# Enter full screen mode # Enter full screen mode
SessionScreenFull(inSessionHex) SessionScreenFull(inSessionHex)
time.sleep(2) time.sleep(2)
# Run CMD operations # Run CMD operations
lResult = SystemCMDRun(inCMDCommandStr = inCMDCommandStr, inModeStr = inModeStr) lResult = SystemCMDRun(inCMDCommandStr = inCMDCommandStr, inModeStr = inModeStr, inClipboardTimeoutSec = inClipboardTimeoutSec)
# Exit fullscreen mode # Exit fullscreen mode
SessionScreen100x550(inSessionHex) SessionScreen100x550(inSessionHex)
# Check if session is in Full screen mode # Check if session is in Full screen mode

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

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

Loading…
Cancel
Save