<%@ LANGUAGE="VBScript" %> <% time_start=Now() ' actions(0,i) action ' actions(1,i) description ' actions(2,i) group ' Dim actions(2,20) Dim action_results(1,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(6) If Request("text_only")=1 Then text_only=true End If If text_only then color(0)="O" color(1)="R" color(2)="C" color(3)="U" color(4)="N" color(5)="P" color(6)="W" Else color(0)=""" Then run_type=CStr(Request("run_type")) Else run_type="ALLBEAM" End If ' ' Get first and last run number ' If Request("run_min")<>"" Then rmin=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 ' ' 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 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")) Set RS=nothing ' ' ' 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) %> Sequence Production Status

Sequence Production Status

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

<% if text_only then response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") else response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") End if %>
" & color(0) & "" & color(1) & "" & color(2) & "" & color(3) & "" & color(4) & "" & color(5) & "" & color(6) & "" & color(0) & ">" & color(1) & ">" & color(2) & ">" & color(3) & ">" & color(4) & ">" & color(5) & ">" & color(6) & ">
OK Sequence still running CRASH Unknown Not done In progress Waiting
<% ' ' 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 ' ' 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 If run_old<>-10000 Then Response.write(" " & vbCrLf) Response.Write("
") Response.write("" & vbCrLf) 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 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")) 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(5)' 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 s_wait=false s_start=false s_end=false' For i=0 to nactions-1 If actions(2,i)="SINKING" then If actions(0,i)="SINK_WAIT_SEQ" then If Cint(action_results(0,i))>0 then s_wait=true end if Elseif actions(0,i)="SINK_START_SEQ" then If Cint(action_results(0,i))>0 then s_start=true end if Elseif actions(0,i)="SINK_END_SEQ" then If Cint(action_results(0,i))>0 then s_end=true end if end if end if Next If ((not s_wait) and (not s_start) and (not s_end)) then action_groups(1,igroup)=color(4) ' not done Elseif (s_wait and (not s_start) and (not s_end)) then action_groups(1,igroup)=color(6)' waiting Elseif ( s_wait and s_start and (not s_end) ) then action_groups(1,igroup)=color(5) ' in progress Elseif ((not s_wait) and s_start and (not s_end)) then action_groups(1,igroup)=color(5) 'in progress ' add the condition of long time here Elseif (s_wait and s_start and s_end) then action_groups(1,igroup)=color(0) ' ok Elseif ((not s_wait) and s_start and s_end) then action_groups(1,igroup)=color(0) ' ok Elseif ((not s_wait) and (not s_start) and s_end) then action_groups(1,igroup)=color(0) ' ok else action_groups(1,igroup)=color(3) ' unknown or error 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 If Cint(action_results(0,i))>0 then s_wait=true end if Elseif actions(0,i)="P0_START_SEQ" then If Cint(action_results(0,i))>0 then s_start=true end if Elseif actions(0,i)="P0_END_SEQ" then If Cint(action_results(0,i))>0 then s_end=true end if end if end if Next If ((not s_wait) and (not s_start) and (not s_end)) then action_groups(1,igroup)=color(4) ' not done Elseif (s_wait and (not s_start) and (not s_end)) then action_groups(1,igroup)=color(6)' waiting Elseif ( s_wait and s_start and (not s_end) ) then 'if time(now)-time(s_start)>5hrs (convert in seconds) then crash 'else in progress action_groups(1,igroup)=color(5) ' in progress Elseif ((not s_wait) and s_start and (not s_end)) then 'if time(now)-time(s_start)>5hrs (convert in seconds) then crash 'else in progress action_groups(1,igroup)=color(5) 'in progress Elseif (s_wait and s_start and s_end) then action_groups(1,igroup)=color(0) ' ok Elseif ((not s_wait) and s_start and s_end) then action_groups(1,igroup)=color(0) ' ok Elseif ((not s_wait) and (not s_start) and s_end) then action_groups(1,igroup)=color(0) ' ok else action_groups=color(3) ' unknown or error 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 ' ' Print the full row ' response.write("" & vbCrLf) For igroup=0 To ngroups-1 If text_only then Response.write("" &vbCrLf) Else Response.write("" & vbCrLf) End if Next ' close row for this sequence ' If 0= (sequence+1) Mod 4 then Response.write("" & vbCrLf) else response.write("" & vbCrLf) end if Loop ' ' close table for last run/sequence ' Response.write("
Run ") Response.write( run & "" & sequence & "" & action_groups(1,igroup) & " " & vbCrLf) Response.write( action_groups(1,igroup) & vbCrLf) Response.write(" alt=""" & action_groups(0,igroup) & """>
         
" & vbCrLf) %>

Legend

    <% For i=0 To ngroups-1 %>
  1. <% Response.write (action_groups(0,i)) %>
  2. <% Next %>
<% ' ' 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) %> <%=time_tot%>