@ -75,7 +75,6 @@ def AgentActivityItemExists(inGSettings, inHostNameStr, inUserStr, inGUIDStr):
lAgentDictItemKeyTurple = ( inHostNameStr . upper ( ) , inUserStr . upper ( ) )
lAgentDictItemKeyTurple = ( inHostNameStr . upper ( ) , inUserStr . upper ( ) )
lResultBool = False
lResultBool = False
if lAgentDictItemKeyTurple in inGSettings [ " AgentDict " ] :
if lAgentDictItemKeyTurple in inGSettings [ " AgentDict " ] :
inGSettings [ " AgentDict " ] [ lAgentDictItemKeyTurple ] = SettingsTemplate . __AgentDictItemCreate__ ( )
for lActivityItem in inGSettings [ " AgentDict " ] [ lAgentDictItemKeyTurple ] [ " ActivityList " ] :
for lActivityItem in inGSettings [ " AgentDict " ] [ lAgentDictItemKeyTurple ] [ " ActivityList " ] :
if inGUIDStr == lActivityItem . get ( " GUIDStr " , None ) :
if inGUIDStr == lActivityItem . get ( " GUIDStr " , None ) :
lResultBool = True
lResultBool = True
@ -144,6 +143,7 @@ def AgentOSFileSend(inGSettings, inHostNameStr, inUserStr, inOrchestratorFilePat
"""
"""
Send the file from the Orchestrator to Agent ( synchroniously ) pyOpenRPA . Agent daemon process ( safe for JSON transmition ) .
Send the file from the Orchestrator to Agent ( synchroniously ) pyOpenRPA . Agent daemon process ( safe for JSON transmition ) .
Work safety with big files
Work safety with big files
Thread safe - you can call def even if you dont init the orchestrator - def will be executed later
: param inGSettings : Global settings dict ( singleton )
: param inGSettings : Global settings dict ( singleton )
: param inHostNameStr :
: param inHostNameStr :
@ -152,6 +152,20 @@ def AgentOSFileSend(inGSettings, inHostNameStr, inUserStr, inOrchestratorFilePat
: param inFileDataBytes :
: param inFileDataBytes :
: return : GUID String of the ActivityItem - you can wait ( sync or async ) result by this guid !
: return : GUID String of the ActivityItem - you can wait ( sync or async ) result by this guid !
"""
"""
# Check thread
if inGSettings [ " ServerDict " ] [ " ServerThread " ] is None :
if inGSettings [ " Logger " ] : inGSettings [ " Logger " ] . warning ( f " AgentOSFileSend run before server init - activity will be append in the processor queue. " )
lResult = {
" Def " : AgentOSFileSend , # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
" ArgList " : [ ] , # Args list
" ArgDict " : { " inHostNameStr " : inHostNameStr , " inUserStr " : inUserStr , " inOrchestratorFilePathStr " : inOrchestratorFilePathStr , " inAgentFilePathStr " : inAgentFilePathStr } , # Args dictionary
" ArgGSettings " : " inGSettings " , # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
" ArgLogger " : None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
}
inGSettings [ " ProcessorDict " ] [ " ActivityList " ] . append ( lResult )
else : # In processor - do execution
lActivityItemCheckIntervalSecFloat = inGSettings [ " ServerDict " ] [ " AgentFileChunkCheckIntervalSecFloat " ]
lActivityItemCheckIntervalSecFloat = inGSettings [ " ServerDict " ] [ " AgentFileChunkCheckIntervalSecFloat " ]
# Get the chunk limit
# Get the chunk limit
@ -163,7 +177,8 @@ def AgentOSFileSend(inGSettings, inHostNameStr, inUserStr, inOrchestratorFilePat
lFile = open ( inOrchestratorFilePathStr , " rb " )
lFile = open ( inOrchestratorFilePathStr , " rb " )
lFileSizeBytesInt = lFile . seek ( 0 , 2 )
lFileSizeBytesInt = lFile . seek ( 0 , 2 )
lFile . seek ( 0 )
lFile . seek ( 0 )
#import pdb
#pdb.set_trace()
lChunkCountInt = math . ceil ( lFileSizeBytesInt / lChunkByteSizeInt )
lChunkCountInt = math . ceil ( lFileSizeBytesInt / lChunkByteSizeInt )
if lL : lL . info ( f " O2A: Start to send binary file via chunks. Chunk count: { lChunkCountInt } , From (Orch side): { inOrchestratorFilePathStr } , To (Agent side): { inAgentFilePathStr } " )
if lL : lL . info ( f " O2A: Start to send binary file via chunks. Chunk count: { lChunkCountInt } , From (Orch side): { inOrchestratorFilePathStr } , To (Agent side): { inAgentFilePathStr } " )
for lChunkNumberInt in range ( lChunkCountInt ) :
for lChunkNumberInt in range ( lChunkCountInt ) :
@ -185,6 +200,8 @@ def AgentOSFileSend(inGSettings, inHostNameStr, inUserStr, inOrchestratorFilePat
time . sleep ( lActivityItemCheckIntervalSecFloat )
time . sleep ( lActivityItemCheckIntervalSecFloat )
if lL : lL . debug (
if lL : lL . debug (
f " O2A: BINARY SEND: Current chunk index: { lChunkNumberInt } " )
f " O2A: BINARY SEND: Current chunk index: { lChunkNumberInt } " )
if lL : lL . info (
f " O2A: BINARY SEND: Transmition has been complete " )
# Close the file
# Close the file
lFile . close ( )
lFile . close ( )
@ -2131,6 +2148,7 @@ def Orchestrator(inGSettings, inDumpRestoreBool = True, inRunAsAdministratorBool
lItemDict = lListenDict [ lItemKeyStr ]
lItemDict = lListenDict [ lItemKeyStr ]
lThreadServer = Server . RobotDaemonServer ( lItemKeyStr , gSettingsDict )
lThreadServer = Server . RobotDaemonServer ( lItemKeyStr , gSettingsDict )
lThreadServer . start ( )
lThreadServer . start ( )
gSettingsDict [ " ServerDict " ] [ " ServerThread " ] = lThreadServer
lItemDict [ " ServerInstance " ] = lThreadServer
lItemDict [ " ServerInstance " ] = lThreadServer
# Init the RobotScreenActive in another thread
# Init the RobotScreenActive in another thread