%@ LANGUAGE="VBScript" %>
<%
time_start=Now()
dim jobs
dim crash
dim waiting
dim s_start
dim s_end
dim s_old
dim s_wait
dim wait_time
dim start_time
dim end_time
Dim st_pedcalc
dim ed_pedcalc
dim c
dim agroup
' actions(0,i) action
' actions(1,i) description
' actions(2,i) group
'
'
Dim actions(2,20)
'
'action_results(0,i)integer number of times the action took place( imp in sinking and pass)
'action_results(1,i) datevalue action time
'
Dim action_results(2,20)
'
'
' groups
' action_groups(0,i) name
' action_groups(1,i) display result
'
Dim action_groups(1,20)
Dim color(5)
color(0)="Ok"
color(1)="Progress"
color(2)="Crash"
color(3)="Unknown"
color(4)="Not done"
color(5)="Waiting"
Function actiongroup(action_name)
igroup=-1
For i=0 To ngroups-1
If action_groups(0,i)=action_name Then
igroup=i
Exit For
End If
Next
actiongroup=igroup
end Function
'
' the database is programmed to send a fixed number of
' records for each run. We will select a set of runs of a given run type
' For each run type there is a well defined sequence of actions that need to be
' taken. To save network and computing bandwidth we will get a detailed list of
' actions and then assume that the individual run data comes in the same sequence.
'
' The actions will be stored in an array
'
'
If Request("run_type")<>"" Then
run_type=CStr(Request("run_type"))
Else
run_type="ALLBEAM"
End If
'
' Get first and last run number
'
If Request("run_min")<>"" Then
run_min=CInt(Request("run_min"))
Else
run_min=6175
End If
If Request("run_max")<>"" Then
run_max=CInt(Request("run_max"))
Else
run_max=6176
End If
if request("type")<>"" then
typ=cstr(request("type"))
end if
jobs=false
crash=false
waiting=false
if request("type")="crash" then
crash=true
Elseif request("type")="waiting" then
waiting=true
else
jobs=true
end if
if request("jobs")<>"" then
jo=cstr(Request("jobs"))
end if
if Request("jobs")="SINKING" then
sinking=true
elseif request("jobs")="PASS0" then
pass=true
elseif request("jobs")="DV" then
dv=true
end if
agroup=cstr(Request("jobs"))
'
' Open Database
'
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = adModeRead
Connection.Open phdb_rd
'
' This SQL statement gives an ordered list of actions related to run of type run_type
'
SQLStmt = " select ta.action,la.action_group,la.description from phoffline.track_actions ta,phoffline.log_actions la "
SQLStmt = SQLStmt & " where la.action=ta.action and la.action_type=2 and ta.run_type='" & run_type & "' "
if not(agroup="DV") then
SQLStmt = SQLStmt & " and la.action_group='" & agroup &"' "
end if
SQLStmt = SQLStmt & " order by la.action_order "
Set RS = Connection.Execute(SQLStmt)
nactions=0
ngroups=0
old_group=""
Do While Not RS.EOF
group=CStr(RS("action_group"))
actions(0,nactions)=CStr(RS("action"))
actions(1,nactions)=CStr(RS("description"))
actions(2,nactions)=group
nactions=nactions+1
If group<>old_group Then
action_groups(0,ngroups)=group
ngroups=ngroups+1
old_group=group
End If
RS.MoveNext
Loop
Set RS=nothing
i_sinking=actiongroup("SINKING")
i_pass0=actiongroup("PASS0")
i_dv=actiongroup("DV")
newvar=actiongroup(agroup)
'
' Get last run and sequence
'
SQLStmt = " select max(run) last_run,max(sequence) last_sequence ,to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') timedate from phoffline.runseqs "
SQLStmt = SQLStmt & " where run=(select max(run) from phoffline.runseqs) "
Set RS = Connection.Execute(SQLStmt)
last_run=CStr(RS("last_run"))
last_sequence=CStr(RS("last_sequence"))
timedate=formatdatetime(RS("timedate"),0)
'
'
' And this statement lists the run number and the number of times a given
' action was performed. 0 means that the action was never done.
'
SQLStmt = " select max(ta1.run) run,max(ta1.sequence) sequence,count(rl.action) naction,to_char(max(rl.log_date),'MM/DD/YYYY HH24:MI:SS') ddate from "
SQLStmt = SQLStmt & " (select rn.run,rn.sequence,ruu.run_type,ta.action,le.log_date from phoffline.log_entries le,phoffline.log_actions la, "
SQLStmt = SQLStmt & " phoffline.runseq_numbers rn, phoffline.runs ruu, phoffline.runseqs ru,phoffline.track_actions ta "
SQLStmt = SQLStmt & " where ta.action=le.action and la.action=ta.action and rn.logid=le.logid and rn.run=ru.run and rn.run=ruu.run and ru.sequence=rn.sequence "
SQLStmt = SQLStmt & " and ruu.run_type='" & run_type & "' "
SQLStmt = SQLStmt & " and ta.run_type=ruu.run_type and la.action_type=2 "
if not(agroup="DV") then
SQLStmt = SQLStmt & " and la.action_group='" & agroup &"' "
end if
SQLStmt = SQLStmt & " and ruu.run between " & CStr(run_min) & " and " & CStr(run_max) & ") rl, "
SQLStmt = SQLStmt & " (select r.run,r.sequence,l.action,l.action_order,rr.run_type "
SQLStmt = SQLStmt & " from phoffline.track_actions t,phoffline.runseqs r,phoffline.runs rr,phoffline.log_actions l "
SQLStmt = SQLStmt & " where rr.run_type='" & run_type & "' "
if not(agroup="DV") then
SQLStmt = SQLStmt & " and l.action_group='" & agroup &"' "
end if
SQLStmt = SQLStmt & " and l.action=t.action and t.run_type=rr.run_type and r.run=rr.run and l.action_type=2 "
SQLStmt = SQLStmt & " and r.run between " & CStr(run_min) & " and " & CStr(run_max) & ") ta1 "
SQLStmt = SQLStmt & " where ta1.action=rl.action(+) and ta1.run=rl.run(+) and ta1.sequence=rl.sequence(+)"
SQLStmt = SQLStmt & " group by ta1.run,ta1.sequence,ta1.action "
SQLStmt = SQLStmt & " order by ta1.run desc,ta1.sequence,max(ta1.action_order) "
' response.write(SQLStmt & "
")
Set RS = Connection.Execute(SQLStmt)
%>
Run ") Response.write( run & " | " & vbCrLf) End If run_old=run ' new run becomes old run from now on Else ' ' same run ' if c<>c_old then If 0= (c) Mod 6 then Response.write("||||
" & vbCrLf) end if end if End If ' ' write info for one sequence now. We know how many entries are for this sequence ' a priori so we can rely on For loop in advancing the records. ' ' For i=0 To nactions-1 action_results(0,i)=CInt(RS("naction")) if not isnull(RS("ddate"))then action_results(1,i)=formatdatetime(RS("ddate"),0) else action_results(1,i)="1/1/85" ' very old date such that the difference is huge end if nloop=nloop+1 RS.MoveNext Next ' 'Sink analysis ' igroup=i_sinking If igroup>-1 Then For i=0 to nactions-1 If actions(2,i)="SINKING" then If actions(0,i)="SINK_WAIT_SEQ" then s_wait=cint(action_results(0,i)) wait_time=action_results(1,i) Elseif actions(0,i)="SINK_START_SEQ" then s_start=cint(action_results(0,i)) start_time=action_results(1,i) Elseif actions(0,i)="SINK_END_SEQ" then s_end=cint(action_results(0,i)) end_time=action_results(1,i) end if end if Next if (s_start<=0 and s_end<=0) then if s_wait<=0 then action_groups(1,igroup)=color(4) ' not done elseif s_wait>0 then if datediff("s",wait_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if elseif(s_start>0 and s_end<=0) then if s_wait<=0 then if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if else if datediff("s",wait_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if elseif(s_start>0 and s_end>0) then if s_wait<=0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if else if datediff("s",wait_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if Elseif (s_start<=0 and s_end>0) then if s_wait<=0 then action_groups(1,igroup)=color(0)'ok elseif s_wait>0 then if datediff("s",wait_time,end_time)>0 then action_groups(1,igroup)=color(0) 'ok else if datediff("s",wait_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if end if end if ' 'Pass analysis ' igroup=i_pass0 If igroup>-1 Then s_wait=false s_start=false s_end=false' For i=0 to nactions-1 If actions(2,i)="PASS0" then If actions(0,i)="P0_SUBMIT_SEQ" then s_wait=cint(action_results(0,i)) wait_time=action_results(1,i) Elseif actions(0,i)="P0_START_SEQ" then s_start=cint(action_results(0,i)) start_time=action_results(1,i) Elseif actions(0,i)="P0_END_SEQ" then s_end=cint(action_results(0,i)) end_time=action_results(1,i) end if end if Next if (s_start<=0 and s_end<=0) then if s_wait<=0 then action_groups(1,igroup)=color(4) ' not done elseif s_wait>0 then if datediff("s",wait_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if elseif(s_start>0 and s_end<=0) then if s_wait<=0 then if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if else if datediff("s",wait_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if elseif(s_start>0 and s_end>0) then if s_wait<=0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if else if datediff("s",wait_time,timedate)>21600 then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if end if end if ' ' DV analysis ' find if has been processed by DV, this is run only if run type is ALLBEAM ' loop through the action_groups array to see if DV present ' igroup=i_dv If igroup>-1 Then s_start=false For i=0 to nactions-1 If actions(2,i)="DV" Then If actions(0,i)="DV_PLOT_SEQ" Then If CInt(action_results(0,i))>0 Then s_start=true End If End If End If Next ' ' make the final decision ' If s_start Then action_groups(1,igroup)=color(0)'green ,ok Else action_groups(1,igroup)=color(4) 'grey, not done End If End if ' 'Print results ' if jobs then if not (agroup="DV") then if not action_groups(1,newvar)=color(0) then response.write(" | " & sequence & " | " & vbCrLf) c= c + 1 else c_old=c end if else if not action_groups(1,newvar)=color(0) and action_groups(1,i_sinking)=color(0) and action_groups(1,i_pass0)=color(0) then response.write("" & sequence & " | " & vbCrLf) c= c + 1 else c_old=c end if end if elseif crash then if action_groups(1,newvar)=color(2) then response.write("" & sequence & " | " & vbCrLf) c= c + 1 else c_old=c end if elseif waiting then if action_groups(1,newvar)=color(5) then response.write("" & sequence & " | " & vbCrLf) c= c + 1 else c_old=c end if end if Loop ' ' close table for last run/sequence ' Response.write("