Add pause trigger to RDPActive when Processor is working!

dev-linux
Ivan Maslov 4 years ago
parent 1f1eaf027c
commit b149647594

@ -1,7 +1,8 @@
# 1.2.0 - general processor - contains old orchestrator processor + RDPActive processor # 1.2.0 - general processor - contains old orchestrator processor + RDPActive processor
import time, copy, threading import time, copy, threading
# Run processor synchronious # Run processor synchronious
def ProcessorRunSync(inGSettings): # inThreadControlDict = {"ThreadExecuteBool":True}
def ProcessorRunSync(inGSettings, inRobotRDPThreadControlDict):
""" """
"ProcessorDict": { # Has been changed. New general processor (one threaded) v.1.2.0 "ProcessorDict": { # Has been changed. New general processor (one threaded) v.1.2.0
"ActivityList": [ # List of the activities "ActivityList": [ # List of the activities
@ -24,7 +25,9 @@ def ProcessorRunSync(inGSettings):
if len(lActivityList)>0: if len(lActivityList)>0:
if lL: lL.debug(f'Processor ActivityList len: {len(lActivityList)}') if lL: lL.debug(f'Processor ActivityList len: {len(lActivityList)}')
lActivityItem = inGSettings["ProcessorDict"]["ActivityList"].pop(0) # Extract the first item from processor queue lActivityItem = inGSettings["ProcessorDict"]["ActivityList"].pop(0) # Extract the first item from processor queue
inRobotRDPThreadControlDict["ThreadExecuteBool"]=False # Stop the RobotRDPActive monitoring
ActivityListExecute(inGSettings = inGSettings, inActivityList = [lActivityItem]) # execute the activity item ActivityListExecute(inGSettings = inGSettings, inActivityList = [lActivityItem]) # execute the activity item
inRobotRDPThreadControlDict["ThreadExecuteBool"] = True # Continue the RobotRDPActive monitoring
else: else:
time.sleep(inGSettings["ProcessorDict"]["CheckIntervalSecFloat"]) # Sleep when list is empty time.sleep(inGSettings["ProcessorDict"]["CheckIntervalSecFloat"]) # Sleep when list is empty

@ -5,7 +5,8 @@ from . import ConnectorExceptions # Exceptions classes
from . import Connector from . import Connector
from . import Processor # Module for process some functions on thr RDP from . import Processor # Module for process some functions on thr RDP
# Main function # Main function
def RobotRDPActive(inGSettings): # inThreadControlDict = {"ThreadExecuteBool":True}
def RobotRDPActive(inGSettings, inThreadControlDict):
# inGSettings = { # inGSettings = {
# ... "RobotRDPActive": {} ... # ... "RobotRDPActive": {} ...
# } # }
@ -36,6 +37,7 @@ def RobotRDPActive(inGSettings):
lResponsibilityCheckLastSec = time.time() # Get current time for check interval lResponsibilityCheckLastSec = time.time() # Get current time for check interval
while lFlagWhile: while lFlagWhile:
try: try:
if inThreadControlDict["ThreadExecuteBool"] == True:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Check RDP window is OK - reconnect if connection was lost # Check RDP window is OK - reconnect if connection was lost
lUIOSelectorList = [] lUIOSelectorList = []
@ -65,19 +67,6 @@ def RobotRDPActive(inGSettings):
if lL: lL.exception(f"!!! ATTENTION !!! Unrecognized error") #Logging if lL: lL.exception(f"!!! ATTENTION !!! Unrecognized error") #Logging
pass pass
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Safe turn off the - no need because of Orchestrator control
#if inGlobalDict.get("OrchestratorToRobotResetStorage", {}).get("SafeTurnOff", False):
# lFlagWhile = False
# # Set status disconnected for all RDP List
# for lItem in inGlobalDict["RDPList"]:
# lItem["SessionIsWindowExistBool"] = False
# lItem["SessionIsWindowResponsibleBool"] = False
# # Kill all RDP sessions
# os.system('taskkill /F /im mstsc.exe')
# # Return from function
# return
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Connector.SystemRDPWarningClickOk() # Click all warning messages Connector.SystemRDPWarningClickOk() # Click all warning messages
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Check if RDP session is full screen (if is not ignored) # Check if RDP session is full screen (if is not ignored)

@ -922,7 +922,8 @@ def Orchestrator(inGSettings):
if lL: lL.info("Robot Screen active has been started") #Logging if lL: lL.info("Robot Screen active has been started") #Logging
# Init the RobotRDPActive in another thread # Init the RobotRDPActive in another thread
lRobotRDPActiveThread = threading.Thread(target= RobotRDPActive.RobotRDPActive, kwargs={"inGSettings":gSettingsDict}) lRobotRDPThreadControlDict = {"ThreadExecuteBool":True} # inThreadControlDict = {"ThreadExecuteBool":True}
lRobotRDPActiveThread = threading.Thread(target= RobotRDPActive.RobotRDPActive, kwargs={"inGSettings":gSettingsDict, "inThreadControlDict":lRobotRDPThreadControlDict})
lRobotRDPActiveThread.daemon = True # Run the thread in daemon mode. lRobotRDPActiveThread.daemon = True # Run the thread in daemon mode.
lRobotRDPActiveThread.start() # Start the thread execution. lRobotRDPActiveThread.start() # Start the thread execution.
if lL: lL.info("Robot RDP active has been started") #Logging if lL: lL.info("Robot RDP active has been started") #Logging
@ -939,7 +940,7 @@ def Orchestrator(inGSettings):
Processor.ActivityListOrDict(lActivityItem) Processor.ActivityListOrDict(lActivityItem)
# Processor thread # Processor thread
lProcessorThread = threading.Thread(target= Processor.ProcessorRunSync, kwargs={"inGSettings":gSettingsDict}) lProcessorThread = threading.Thread(target= Processor.ProcessorRunSync, kwargs={"inGSettings":gSettingsDict, "inRobotRDPThreadControlDict":lRobotRDPThreadControlDict})
lProcessorThread.daemon = True # Run the thread in daemon mode. lProcessorThread.daemon = True # Run the thread in daemon mode.
lProcessorThread.start() # Start the thread execution. lProcessorThread.start() # Start the thread execution.
if lL: lL.info("Processor has been started (ProcessorDict)") #Logging if lL: lL.info("Processor has been started (ProcessorDict)") #Logging

Loading…
Cancel
Save