<%@ LANGUAGE="VBScript" %> <% time_start=Now() ' 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) 'create array for assigned icons 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 dim jobs dim crash dim hanging jobs=false crash=false hanging=false if request("type")="crash" then crash=true Elseif request("type")="hanging" then hanging=true else jobs=true end if if Request("jobs")="sinking" then sinking=true elseif request("jobs")="pass" then pass=true elseif request("jobs")="dv" then dv=true end if ' ' 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 & "' " SQLStmt = SQLStmt & " order by la.action_order " ' response.write(SQLStmt) 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 ' ' For i=0 to ngroups-1 ' Response.write(i & " " & action_groups(0,i) & " " & action_groups(1,i) & "
") ' Next ' ' 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 " 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 & "' " 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) %> Jobs Processing Status

Jobs Processing

Runs of type <%=run_type%> from <%=run_min%> to <%=run_max%>

<%If sinking then response.write("

Sinking Jobs") if crash then response.write("  that crashed

") elseif hanging then response.write("  in progress") elseif jobs then response.write("  to be done") end if Elseif pass then response.write("

PASS0 Jobs ") if crash then response.write("that crashed

") elseif hanging then response.write("in progress") elseif jobs then response.write(" to be done") end if Elseif dv then response.write("

DVPLOT Jobs ") if crash then response.write("that crashed

") elseif hanging then response.write("in progress") elseif jobs then response.write(" to be done") end if End if %>
<% ' ' We are now ready to loop through the runs. The number of runs is not known ' at this moment but we are sure that once the run is there it will have nactions-1 columns ' ' dim c ' 'declare the variable for the count of not done sequence ' nloop=0 run_old=-10000 Do While Not RS.EOF run=CStr(RS("run")) sequence=CStr(RS("sequence")) ' ' check if we found a new run. If yes then close table and open new one ' it probably makes no sense to repeat legend every time, the new tables will ' be without headers ' If run<>run_old Then c=0 If run_old<>-10000 Then response.write("") response.write(" " & vbCrLf) Response.Write("Run "& run & "" & vbCrLf) Else response.write("" & vbCrLf) response.write("" & vbCrLf) Response.Write("" & 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 ' ' Find location of this group ' igroup=actiongroup("NEW_SEQUENCE") If igroup>-1 Then dim s_start dim s_end dim s_old s_start=false s_end=false s_old=false For i=0 to nactions-1 If actions(2,i)="NEW_SEQUENCE" Then If actions(0,i)="START_SEQ" Then If CInt(action_results(0,i))>0 Then s_start=true End If Elseif actions(0,i)="END_SEQ" Then If CInt(action_results(0,i))>0 Then s_end=true End If Elseif actions(0,i)="NEW_RUN_SEQUENCE" Then If CInt(action_results(0,i))>0 Then s_old=true End If End If End If Next If (s_start and s_end) Or (s_old) Then action_groups(1,igroup)=color(0)'green ,ok Elseif (s_start and (Not s_end)) Then If (run=last_run And sequence=last_sequence) Then action_groups(1,igroup)=color(1)'yellow, still running Else action_groups(1,igroup)=color(2)'red, crash End If Else action_groups(1,igroup)=color(3) 'blue, unknown End If End If ' 'PEDCALC analysis ' igroup=actiongroup("PEDCALC") If igroup>-1 Then Dim st_pedcalc dim ed_pedcalc st_pedcalc=false ed_pedcalc=false For i=0 to nactions-1 If actions(2,i)="PEDCALC" then If actions(0,i)="START_PEDCALC" then If Cint(action_results(0,i))>0 then st_pedcalc=true end if Elseif actions(0,i)="END_PEDCALC" then If Cint(action_results(0,i))>0 then ed_pedcalc=true End if End if End if Next If (st_pedcalc and ed_pedcalc) then action_groups(1,igroup)=color(0)'ok Elseif (st_pedcalc and (not ed_pedcalc)) then action_groups(1,igroup)=color(1)'in progress else action_groups(1,igroup)=color(4)'not done End if end if ' 'Sink analysis ' igroup=actiongroup("SINKING") If igroup>-1 Then dim s_wait dim wait_time dim start_time dim end_time 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=actiongroup("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=actiongroup("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 If sinking then if jobs then if not action_groups(1,1)=color(0) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if elseif crash then if action_groups(1,1)=color(2) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if elseif hanging then if action_groups(1,1)=color(5) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if end if elseif pass then if jobs then if not action_groups(1,2)=color(0) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if elseif crash then if action_groups(1,2)=color(2) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if elseif hanging then if action_groups(1,2)=color(5) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if end if elseif dv then if jobs then if not action_groups(1,3)=color(0) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if elseif crash then if action_groups(1,3)=color(2) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if elseif hanging then if action_groups(1,3)=color(5) then response.write("" & vbCrLf) c= c + 1 else c_old=c end if end if end if Loop ' ' close table for last run/sequence ' Response.write("
 
Run ") Response.write( run & "
 " & sequence & "" & sequence & "" & sequence & "" & sequence & "" & sequence & "" & sequence & "" & sequence & "" & sequence & "" & sequence & "
" & vbCrLf) %> <% ' ' CLose database connection ' Set RS=nothing Connection.Close Set Connection=nothing time_stop=Now() time_tot=Round(24*60*60*(time_stop-time_start),1) Response.Write("" & time_tot & "," & nloop & "") %>