Refactored process proc queue service to handle more throughput. Fixed Metrology_Services import CDE qual service.
This commit is contained in:
@ -36,7 +36,7 @@ Function Environment_Services(@Service, @Params)
|
||||
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
$insert LOGICAL
|
||||
$insert APP_INSERTS
|
||||
$insert SERVICE_SETUP
|
||||
$insert SRPMail_Inserts
|
||||
|
||||
@ -553,7 +553,20 @@ Service GetEnvironmentVariable(VariableName)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service GetServiceManagerPort()
|
||||
|
||||
FilePath = Drive():'\SRPEngineServer.ini'
|
||||
OSRead IniFile from FilePath then
|
||||
CharIndex = Index(IniFile, 'Port', 1)
|
||||
Line = IniFile[CharIndex, 'F':CRLF$]
|
||||
Response = Trim(Line[-1, 'B='])
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -1259,7 +1259,6 @@ end service
|
||||
Service ImportCDEQualData(RunData, ResourceID, PSN)
|
||||
|
||||
Machine = 'CDE'
|
||||
ResourceID = Field(FileName, ' ', 1, 1)
|
||||
URL = "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV3/":ResourceID:"/header"
|
||||
TimeoutDuration = HTTPClient_Services('GetTimeoutDuration')
|
||||
If TimeoutDuration NE 30 then Httpclient_Services('SetTimeoutDuration', 30)
|
||||
@ -3273,3 +3272,4 @@ LoadRunDataToDatabase:
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
@ -303,15 +303,7 @@ SendCommand:
|
||||
Server = Environment_Services('GetServer')
|
||||
TCPServerSettings@ = Environment_Services('GetApplicationRootIP')
|
||||
Convert '\\' to '' in TCPServerSettings@
|
||||
// Get the port from the SRPEngineServer.ini file instead.
|
||||
FilePath = Drive():'\SRPEngineServer.ini'
|
||||
OSRead IniFile from FilePath then
|
||||
CharIndex = Index(IniFile, 'Port', 1)
|
||||
Line = IniFile[CharIndex, 'F':CRLF$]
|
||||
Port = Trim(Line[-1, 'B='])
|
||||
TCPServerSettings@<2> = Port
|
||||
end
|
||||
|
||||
TCPServerSettings@<2> = Environment_Services('GetServiceManagerPort')
|
||||
TcpClientHandle = 0
|
||||
If SRP_TcpClient(TcpClientHandle, 'CONNECT', TCPServerSettings@<1>, TCPServerSettings@<2>) then
|
||||
SRP_TcpClient(TcpClientHandle, 'SEND_SES', Command)
|
||||
|
@ -40,9 +40,10 @@ Equ Comma$ to ','
|
||||
Common /ServiceServices/ Unused1@, Unused2@, Unused3@, Unused4@, Unused5@, Unused6@, Unused7@, Unused8@, Unused9@, Unused10@
|
||||
|
||||
Declare function Service_Services, Memory_Services, SRP_List, SRP_FastArray, SRP_Array, Database_Services, Datetime
|
||||
Declare function GetTickCount, SRP_Decode, RTI_CreateGuid, UCase, Environment_services, Logging_Services
|
||||
Declare function GetTickCount, SRP_Decode, RTI_CreateGuid, UCase, Environment_services, Logging_Services,
|
||||
Declare function SRP_TCPClient
|
||||
Declare subroutine Service_Services, Memory_Services, SRP_List, SRP_FastArray, RList, Set_Status, Database_Services
|
||||
Declare Subroutine Yield, WinYield, Sleepery, Btree.Extract, Logging_Services, obj_Notes
|
||||
Declare Subroutine Yield, WinYield, Sleepery, Btree.Extract, Logging_Services, obj_Notes, SRP_TCPClient
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ProcQueue'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
@ -166,20 +167,38 @@ end service
|
||||
|
||||
Service ProcessProcedureQueue()
|
||||
|
||||
// Loop through the procedure queue until we can find a process request that is not yet locked
|
||||
// (i.e., already being crunched on by another engine). Process that one request and then end.
|
||||
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||
Lock hSysLists, ServiceKeyID then
|
||||
ServerIP = Environment_Services('GetApplicationRootIP')
|
||||
ServerPort = Environment_Services('GetServiceManagerPort')
|
||||
Convert '\' to '' in ServerIP
|
||||
Open 'PROC_QUEUE' to hProcQueue then
|
||||
Select hProcQueue
|
||||
EOF = False$
|
||||
Done = False$
|
||||
Loop
|
||||
ReadNext RequestKeyID else EOF = True$
|
||||
Until EOF or Done
|
||||
Lock hProcQueue, RequestKeyID then
|
||||
Until EOF
|
||||
TcpClientHandle = 0
|
||||
If SRP_TcpClient(TcpClientHandle, 'CONNECT', ServerIP, ServerPort) then
|
||||
Command = 'RUN SERVICE_SERVICES "ProcessRequest", ':Quote(RequestKeyID)
|
||||
SRP_TcpClient(TcpClientHandle, 'SEND_SES', Command)
|
||||
SRP_TcpClient(TcpClientHandle, 'CLOSE_SES')
|
||||
end
|
||||
Repeat
|
||||
end
|
||||
Unlock hSysLists, ServiceKeyID else Null
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service ProcessRequest(RequestKeyID)
|
||||
|
||||
If RequestKeyID NE '' then
|
||||
DeleteRequest = True$
|
||||
Server = Environment_Services('GetServer')
|
||||
Done = True$
|
||||
Database_Services('GetKeyIDLock', 'PROC_QUEUE', RequestKeyId)
|
||||
If RowExists('PROC_QUEUE', RequestKeyID) then
|
||||
RequestRow = Database_Services('ReadDataRow', 'PROC_QUEUE', RequestKeyID)
|
||||
If RequestRow NE '' then
|
||||
Procedure = RequestRow<PROC_QUEUE.PROC_NAME$>
|
||||
@ -243,7 +262,6 @@ Service ProcessProcedureQueue()
|
||||
SendToGroup = 'OI_SYSADMIN'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
|
||||
// Move request to PROC_QUEUE_FAILED
|
||||
RequestRow<PROC_QUEUE.NUM_ATTEMPTS$> = NumAttempts
|
||||
RequestRow<PROC_QUEUE.LAST_ATTEMPT_DTM$> = Datetime()
|
||||
@ -256,13 +274,37 @@ Service ProcessProcedureQueue()
|
||||
LogData<6> = 'Success'
|
||||
end
|
||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||
end else
|
||||
DeleteRequest = False$
|
||||
// Failed to read request record.
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
LogData = LoggingDTM
|
||||
LogData<2> = Server
|
||||
LogData<3> = RequestKeyId
|
||||
LogData<4> = ''
|
||||
LogData<5> = ''
|
||||
LogData<6> = 'Failed'
|
||||
LogData<7> = 'Failed to read request record. Error_Services error message: ':ErrorMessage
|
||||
ErrCode = ''
|
||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||
// Notify OI_SYSADMIN group
|
||||
Recipients = ''
|
||||
SentFrom = 'SYSTEM'
|
||||
Subject = 'Background Procedure Queue Error'
|
||||
Message = OConv(Datetime(), 'DT2/^H')
|
||||
Message<2> = 'Error on server ':Server
|
||||
Message<3> = 'Failed to read request record. Error_Services error message: ':ErrorMessage
|
||||
Swap @FM with \0D0A\ in Message
|
||||
AttachWindow = ''
|
||||
AttachKey = ''
|
||||
SendToGroup = 'OI_SYSADMIN'
|
||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||
obj_Notes('Create',Parms)
|
||||
end
|
||||
If DeleteRequest then
|
||||
Database_Services('DeleteDataRow', 'PROC_QUEUE', RequestKeyId, True$, False$)
|
||||
end
|
||||
Unlock hProcQueue, RequestKeyID else Null
|
||||
end
|
||||
Repeat
|
||||
end
|
||||
|
||||
end service
|
||||
|
Reference in New Issue
Block a user