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
|
#pragma precomp SRP_PreCompiler
|
||||||
|
|
||||||
$insert LOGICAL
|
$insert APP_INSERTS
|
||||||
$insert SERVICE_SETUP
|
$insert SERVICE_SETUP
|
||||||
$insert SRPMail_Inserts
|
$insert SRPMail_Inserts
|
||||||
|
|
||||||
@ -553,7 +553,20 @@ Service GetEnvironmentVariable(VariableName)
|
|||||||
|
|
||||||
end service
|
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
|
// Internal GoSubs
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@ -1259,7 +1259,6 @@ end service
|
|||||||
Service ImportCDEQualData(RunData, ResourceID, PSN)
|
Service ImportCDEQualData(RunData, ResourceID, PSN)
|
||||||
|
|
||||||
Machine = 'CDE'
|
Machine = 'CDE'
|
||||||
ResourceID = Field(FileName, ' ', 1, 1)
|
|
||||||
URL = "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV3/":ResourceID:"/header"
|
URL = "https://oi-metrology-viewer-prod.mes.infineon.com/api/InfinityQSV3/":ResourceID:"/header"
|
||||||
TimeoutDuration = HTTPClient_Services('GetTimeoutDuration')
|
TimeoutDuration = HTTPClient_Services('GetTimeoutDuration')
|
||||||
If TimeoutDuration NE 30 then Httpclient_Services('SetTimeoutDuration', 30)
|
If TimeoutDuration NE 30 then Httpclient_Services('SetTimeoutDuration', 30)
|
||||||
@ -3273,3 +3272,4 @@ LoadRunDataToDatabase:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -303,15 +303,7 @@ SendCommand:
|
|||||||
Server = Environment_Services('GetServer')
|
Server = Environment_Services('GetServer')
|
||||||
TCPServerSettings@ = Environment_Services('GetApplicationRootIP')
|
TCPServerSettings@ = Environment_Services('GetApplicationRootIP')
|
||||||
Convert '\\' to '' in TCPServerSettings@
|
Convert '\\' to '' in TCPServerSettings@
|
||||||
// Get the port from the SRPEngineServer.ini file instead.
|
TCPServerSettings@<2> = Environment_Services('GetServiceManagerPort')
|
||||||
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
|
|
||||||
|
|
||||||
TcpClientHandle = 0
|
TcpClientHandle = 0
|
||||||
If SRP_TcpClient(TcpClientHandle, 'CONNECT', TCPServerSettings@<1>, TCPServerSettings@<2>) then
|
If SRP_TcpClient(TcpClientHandle, 'CONNECT', TCPServerSettings@<1>, TCPServerSettings@<2>) then
|
||||||
SRP_TcpClient(TcpClientHandle, 'SEND_SES', Command)
|
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@
|
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 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 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'
|
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ProcQueue'
|
||||||
LogDate = Oconv(Date(), 'D4/')
|
LogDate = Oconv(Date(), 'D4/')
|
||||||
@ -166,20 +167,38 @@ end service
|
|||||||
|
|
||||||
Service ProcessProcedureQueue()
|
Service ProcessProcedureQueue()
|
||||||
|
|
||||||
// Loop through the procedure queue until we can find a process request that is not yet locked
|
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||||
// (i.e., already being crunched on by another engine). Process that one request and then end.
|
Lock hSysLists, ServiceKeyID then
|
||||||
|
ServerIP = Environment_Services('GetApplicationRootIP')
|
||||||
|
ServerPort = Environment_Services('GetServiceManagerPort')
|
||||||
|
Convert '\' to '' in ServerIP
|
||||||
Open 'PROC_QUEUE' to hProcQueue then
|
Open 'PROC_QUEUE' to hProcQueue then
|
||||||
Select hProcQueue
|
Select hProcQueue
|
||||||
EOF = False$
|
EOF = False$
|
||||||
Done = False$
|
|
||||||
Loop
|
Loop
|
||||||
ReadNext RequestKeyID else EOF = True$
|
ReadNext RequestKeyID else EOF = True$
|
||||||
Until EOF or Done
|
Until EOF
|
||||||
Lock hProcQueue, RequestKeyID then
|
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$
|
DeleteRequest = True$
|
||||||
Server = Environment_Services('GetServer')
|
Server = Environment_Services('GetServer')
|
||||||
Done = True$
|
Done = True$
|
||||||
Database_Services('GetKeyIDLock', 'PROC_QUEUE', RequestKeyId)
|
If RowExists('PROC_QUEUE', RequestKeyID) then
|
||||||
RequestRow = Database_Services('ReadDataRow', 'PROC_QUEUE', RequestKeyID)
|
RequestRow = Database_Services('ReadDataRow', 'PROC_QUEUE', RequestKeyID)
|
||||||
If RequestRow NE '' then
|
If RequestRow NE '' then
|
||||||
Procedure = RequestRow<PROC_QUEUE.PROC_NAME$>
|
Procedure = RequestRow<PROC_QUEUE.PROC_NAME$>
|
||||||
@ -243,7 +262,6 @@ Service ProcessProcedureQueue()
|
|||||||
SendToGroup = 'OI_SYSADMIN'
|
SendToGroup = 'OI_SYSADMIN'
|
||||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||||
obj_Notes('Create',Parms)
|
obj_Notes('Create',Parms)
|
||||||
|
|
||||||
// Move request to PROC_QUEUE_FAILED
|
// Move request to PROC_QUEUE_FAILED
|
||||||
RequestRow<PROC_QUEUE.NUM_ATTEMPTS$> = NumAttempts
|
RequestRow<PROC_QUEUE.NUM_ATTEMPTS$> = NumAttempts
|
||||||
RequestRow<PROC_QUEUE.LAST_ATTEMPT_DTM$> = Datetime()
|
RequestRow<PROC_QUEUE.LAST_ATTEMPT_DTM$> = Datetime()
|
||||||
@ -256,13 +274,37 @@ Service ProcessProcedureQueue()
|
|||||||
LogData<6> = 'Success'
|
LogData<6> = 'Success'
|
||||||
end
|
end
|
||||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
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
|
end
|
||||||
If DeleteRequest then
|
If DeleteRequest then
|
||||||
Database_Services('DeleteDataRow', 'PROC_QUEUE', RequestKeyId, True$, False$)
|
Database_Services('DeleteDataRow', 'PROC_QUEUE', RequestKeyId, True$, False$)
|
||||||
end
|
end
|
||||||
Unlock hProcQueue, RequestKeyID else Null
|
|
||||||
end
|
end
|
||||||
Repeat
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end service
|
end service
|
||||||
|
Reference in New Issue
Block a user