Subversion Repositories DevTools

Rev

Rev 6876 | Rev 7063 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5670 dpurdie 1
<% @LANGUAGE = VBScript %>
5623 dpurdie 2
<%
3
'=====================================================
4
'
5
'  Build Status and Plan Information
6
'
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
' Good idea to set when using redirect
12
Response.Expires = 0  ' always load the page, dont store
13
%>
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/_form_window_common.asp"-->
20
<!--#include file="_action_buttons.asp"-->
21
<!--#include file="common/daemon_instructions.asp"-->
6166 dpurdie 22
<!--#include file="common/common_daemon.asp"-->
6048 dpurdie 23
<% '------------ ACCESS CONTROL ------------------ %>
6181 dpurdie 24
<!--#include file="_access_control_login_optional.asp"-->
6070 dpurdie 25
<!--#include file="_access_control_general.asp"-->
6052 dpurdie 26
<!--#include file="_access_control_action_project.asp"-->
5623 dpurdie 27
<% '------------ Scripts -------------------------- %>
28
<%
29
'------------ Variable Definition -------------
30
Dim rsQry
31
Dim parRtagId
32
Dim query_string
33
Dim rcon_id
6786 dpurdie 34
Dim canControl
5623 dpurdie 35
'------------ Constants Declaration -----------
36
'------------ Variable Init -------------------
37
parRtagId = Request("rtag_id")
38
objPMod.PersistInQryString("rtag_id")
6786 dpurdie 39
canControl = canActionControlInProject("BuildControl")
6548 dpurdie 40
'-------------------------------------------------
41
' 
42
Sub ShowDaemonStatus
43
%>
6874 dpurdie 44
<div>
45
    <div class="panel">
46
        <div class=rounded_box_caption>
47
                <table align="center" class="full_table">
48
                   <tr>
49
                      <td nowrap class="form_ttl">DAEMON STATUS INFORMATION
50
                      </td>
51
                      <td  valign="bottom" class="body_rowg">
52
                        Last Build: <%=GetLastBuildAge(parRtagId)%> [<%=GetModifiedSeqNo(parRtagId)%>]
53
                      </td>
54
                      <td align="right" valign="bottom">
55
                        <a class="txt_linked" href="<%=scriptName%>?rtag_id=<%=parRtagId%>" title="Refresh Page">[Refresh]</a>
56
                      </td>
57
                   </tr>
58
                </table>
59
        </div>
60
        <div class='rounded_box'>
61
            <div  class=listPanel>
62
                <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
63
                <!--#include file="messages/_msg_inline.asp"-->
64
                <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
65
                <table width="100%" border="0" cellspacing="2" cellpadding="0">
66
                   <%
67
                   Dim bInactiveMachine : bInactiveMachine = false
68
                   Dim indefinitelyPaused : indefinitelyPaused = Indefinitely_Paused()
69
                   ' Insert a warning into the page if the build daemons are indefintely paused.
70
                   If indefinitelyPaused Then %>
71
                      <tr>
72
                         <span class='err_alert'>
73
                            <font size='2'><b>WARNING: Build Daemons are all stopped - please contact an administrator</b></font>
74
                         </span>
75
                      </tr>
76
                   <%End If
77
                   %>
78
                   <td width="9%" valign="top"></td>
79
                   <thead>
80
                      <th>Daemon Host</th>
81
                      <th>Machine Type</th>
82
                      <th>Mode</th>
83
                      <th>Run Level</th>
84
                      <th>Current Package</th>
85
                      <th>Est Duration<%=Quick_Help("h_buildtime")%></th>
86
                      <th>Last Change<%=Quick_Help("h_lastchange")%></th>
87
                      <th>Control State</th>
88
                   </thead>
89
                   <%
90
                   ' Get Build Information for this Release
91
                   query_string = _
92
                        "SELECT rc.rcon_id, display_name, gbe_value, daemon_mode, NVL(ACTIVE, 'U') AS ACTIVE," &_
93
                        "       rl.pause, rl.current_run_level, rl.current_pkg_id_being_built, TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) AS delta," &_
94
                        "       pk.pkg_name, rl.current_pv_id, pv.build_time, TRUNC (86400*(SYSDATE - rl.LAST_BUILD)) AS build_delta" &_
95
                        " FROM release_config rc," &_
96
                        "   gbe_machtype gm," &_
97
                        "   build_machine_config bm," &_
98
                        "   run_level rl," &_
99
                        "   packages pk," &_
100
                        "   package_versions pv" &_
101
                        " WHERE rc.rtag_id     = " & parRtagId &_
102
                        "  AND gm.gbe_id        = rc.gbe_id" &_
103
                        "  AND rl.rcon_id(+)    = rc.rcon_id" &_
104
                        "  AND rc.bmcon_id      =bm.bmcon_id(+)" &_
105
                        "  AND pk.pkg_id(+)     = rl.current_pkg_id_being_built" &_
106
                        "  AND rl.current_pv_id = pv.pv_id(+)" &_
107
                        " ORDER BY bm.display_name, rc.rcon_id"
5623 dpurdie 108
 
6874 dpurdie 109
                   Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
6548 dpurdie 110
 
6874 dpurdie 111
                   Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
112
                      Dim pkgName
113
                      Dim pkgPvid
114
                      Dim pkgBuildTime
115
                      Dim currentRunLevel
116
                      Dim daemonState
117
                      Dim delta
118
                      Dim PkgBuildDelta
119
                      Dim pkgId
120
                      Dim bActive
121
                      Dim estDuration
122
                      Dim daemonMode 
123
                      Dim lastChange
6548 dpurdie 124
 
6874 dpurdie 125
                      rcon_id = rsQry("rcon_id")
126
                      ' = rsQry("display_name")
127
                      ' = rsQry("gbe_value")
128
                      daemonMode = rsQry("daemon_mode")
129
                      bActive = rsQry("ACTIVE")
130
                      daemonState = rsQry("pause")
131
                      currentRunLevel = rsQry("current_run_level")
132
                      pkgId = rsQry("current_pkg_id_being_built")
133
                      delta = rsQry("delta")
134
                      pkgName = rsQry("pkg_name")
135
                      pkgPvid = rsQry("current_pv_id")
136
                      pkgBuildTime = rsQry("build_time")
137
                      PkgBuildDelta = rsQry("build_delta")
138
                      lastChange = NULL
139
                      bInactiveMachine = FALSE
140
                      estDuration = NULL
6548 dpurdie 141
 
6874 dpurdie 142
                      If bActive = "N" Then bInactiveMachine = true
143
                      If IsNull(daemonState) Then daemonState = 0
144
                      If daemonState = "2" Then pkgId = Null
145
                      If IsNull(currentRunLevel) Then currentRunLevel = -1
146
                      If daemonMode = "M" AND not IsNull(pkgName) Then estDuration = pkgBuildTime & "[" & PkgBuildDelta & "]"
147
                      If bActive <> "U" Then lastChange = PrettyDelta(delta, daemonState,pkgName )
6548 dpurdie 148
 
6874 dpurdie 149
                      ' --- Now render HTML for this release configuration ---
150
                      %>
151
                      <tr class=border>
152
                         <td><%=rsQry("display_name")%></td>
153
                         <td><%=rsQry("gbe_value")%></td>
154
                         <td><%=Get_Daemon_Mode(daemonMode)%></td>
155
                         <td><%=Get_Run_Level(currentRunLevel, indefinitelyPaused, daemonState, bActive)%></td>
156
                         <td><%=Get_Package_Name(pkgName,parRtagId,pkgPvid, daemonState, bActive)%></td>
157
                         <td><%=estDuration%></td>
158
                         <td><%=lastChange%></td>
159
                         <td>
160
                            <%
161
                            If NOT indefinitelyPaused  Then
162
                                If bActive = "U" Then
163
                                ElseIf bActive = "N" Then
164
                                    Call Action_Buttons ( "Daemon Unavailable" )
165
                                ElseIf daemonState = 0 Then
166
                                    Call Action_Buttons_State ( "Daemon Pause", canControl )
167
                                ElseIf daemonState = 1 Then
168
                                    Call Action_Buttons_State ( "Daemon Resume", canControl )
169
                                ElseIf daemonState = 2 Then
170
                                    Call Action_Buttons_State ( "Daemon Start", canControl )
171
                                Else
172
                                    Call Action_Buttons_State ( "Daemon Resume", canControl )
173
                              End If
174
                            Else
175
                               %>Unavailable<%
176
                            End If
177
                            %>
178
                         </td>
179
                      </tr>
180
                      <%
181
                      rsQry.MoveNext
182
                   Loop
183
                   %>
184
                   <tr class=foot>
185
                     <td colspan=7>
186
                     <%If CheckConfigErrors(parRtagId) OR bInactiveMachine Then%><span class="err_alert">&nbsp;Daemon configuration errors detected</span>
187
                        <a class="txt_linked" href="release_config.asp?rtag_id=<%=parRtagId%>">
188
                            <img src="images/i_link.gif" hspace="2" border="0" align="absmiddle" title="Goto Configuration">
189
                        </a>
190
                     <%End If%>
191
                     </td>
192
                     <td>
193
                     <%
194
                       If (rsQry.RecordCount > 0) AND NOT indefinitelyPaused Then
195
                           Call Action_Buttons_State ( "Daemon Control All", objAccessControl.UserLogedIn AND canControl )
196
                       Else
197
                         %>&nbsp<%
198
                       End If
199
                     %>
200
                     </td>
201
                   </tr>
202
                   <%
203
                     rsQry.Close()
204
                     Set rsQry = nothing
205
                   %>
206
                </table>
207
            </div>
208
        </div>
209
    </div>
210
</div>
6548 dpurdie 211
<%
212
End Sub
213
'-------------------------------------------------
214
' 
215
Sub ShowBuildPlan
216
Set rsQry = OraDatabase.DbCreateDynaset( "SELECT TRUNC (86400*(SYSDATE - rl.LAST_BUILD)) as delta, rl.LAST_BUILD as BuildStart, rl.current_pv_id, SYSDATE" &_
217
                                        " FROM release_config rc,  run_level rl " &_
218
                                        " WHERE rc.rtag_id   = " & parRtagId &_
6873 dpurdie 219
                                        " AND rc.daemon_mode = 'M' AND rl.rcon_id(+) = rc.rcon_id", ORADYN_DEFAULT )
6548 dpurdie 220
Dim BuildStart
221
Dim BuildDelta
222
Dim BuildPvId
223
Dim BuildNow
224
If (rsQry.RecordCount > 0) Then
225
    BuildStart = rsQry("BuildStart")
226
    BuildDelta = rsQry("delta")
227
    BuildPvId  = rsQry("current_pv_id")
228
    BuildNow  = rsQry("SYSDATE")
229
End If
230
rsQry.Close()
231
Set rsQry = nothing
232
%>
6874 dpurdie 233
<!-- Planned Builds Display -->
234
<div>
235
<div class=panel>
236
        <div class=rounded_box_caption>
237
                <table align="center" class="full_table">
6548 dpurdie 238
                   <tr>
6874 dpurdie 239
                      <td nowrap class="form_ttl">DAEMON BUILD PLAN<%=Quick_Help("h_buildplan")%></td>
240
                      <td class="body_rowg" align="right" valign="bottom">Now: <%=DisplayShortDateTimeSecs(BuildNow)%> AWST</td>
6548 dpurdie 241
                   </tr>
6874 dpurdie 242
                </table>
243
        </div>
244
        <div class="rounded_box">
245
            <div class='listPanel'>
246
                <table class='embedded_table'>
247
                   <thead>
248
                      <th>Package</th>
249
                      <th>Version</th>
250
                      <th>Duration<%=Quick_Help("h_buildDuration")%></th>
251
                      <th>Build Completion<%=Quick_Help("h_buildEnd")%></th>
252
                   </thead>
6548 dpurdie 253
                   <%
254
                   Dim PkgVersion, buildDuration, durationDisplay, durationText, completionText
255
                   Set rsQry = OraDatabase.DbCreateDynaset( "SELECT p.PKG_NAME," &_
256
                                                            "  pv.PKG_VERSION, pv.BUILD_TIME," &_
257
                                                            "  bp.PV_ID" &_
258
                                                            " FROM build_plan bp," &_
259
                                                            "  packages p," &_
260
                                                            "  package_versions pv" &_
261
                                                            " WHERE bp.PV_ID = pv.pv_id" &_
262
                                                            " AND RTAG_ID = " & parRtagId &_
263
                                                            " AND pv.PKG_ID  = p.pkg_id" &_
264
                                                            " ORDER BY build_order" , ORADYN_DEFAULT )
6549 dpurdie 265
                   If rsQry.RecordCount = 0 Then
266
                       %>
267
                       <tr>
268
                        <td nowrap colspan="4" align="center" class="body_txt">No packages to be built </td>
269
                       </tr>
270
                       <%
271
                   End If
6548 dpurdie 272
                   While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
273
                       completionText = ""
274
                       buildDuration = rsQry("BUILD_TIME")
275
                       durationDisplay = buildDuration
276
 
277
                       ' If the current package build it taking longer than expected , then bump the build times
278
                       ' and allow another 30 seconds.
279
                       If BuildPvId = rsQry("PV_ID") Then
280
                           completionText = "&nbsp;<"
281
                           durationDisplay = durationDisplay & " ["& BuildDelta &"]"
282
                           If BuildDelta > buildDuration Then
283
                                buildDuration = BuildDelta + 30
284
                                completionText = "&nbsp;+"
285
                           End If
286
                       End If
287
 
288
                       ' If the duration is not known - guess at 300 sconds
289
                       durationText = ""
290
                       If ISNULL(buildDuration)  OR buildDuration = 0 Then
291
                            buildDuration = 300
292
                            durationText = "&nbsp;~"
293
                      End If
294
 
295
                      BuildStart = DateAdd("s", buildDuration, BuildStart)
296
                      %>
6874 dpurdie 297
                      <tr class=border>
6623 dpurdie 298
                         <td><%=Get_Package_Name(rsQry("PKG_NAME"), parRtagId, rsQry("PV_ID"), 0, "Y")%></td>
6548 dpurdie 299
                         <td><%=rsQry("PKG_VERSION")%></td>
300
                         <td><%=durationDisplay%></td>
301
                         <td><%=DisplayShortDateTimeSecs(BuildStart) & durationText  & completionText%></td>
302
                      </tr>
303
                      <%
304
                      ' Allow for 20 seconds of planning between builds
305
                      BuildStart = DateAdd("s", 20, BuildStart)
306
                      rsQry.MoveNext()
307
                   Wend
308
                   rsQry.Close()
309
                   Set rsQry = nothing
310
                   %>
311
                </table>
6874 dpurdie 312
            </div>
313
        </div>
314
    </div>
315
</div>
6548 dpurdie 316
<%
317
End Sub
318
'-------------------------------------------------
319
'
320
%>
5623 dpurdie 321
<html>
322
   <head>
323
      <title>Release Manager</title>
324
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
325
      <meta http-equiv="Pragma" content="no-cache">
326
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 327
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
328
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
329
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
5623 dpurdie 330
      <!--#include file="_jquery_includes.asp"-->
331
      <!-- TIPS -->
6676 dpurdie 332
      <script type="text/javascript" src="scripts/json2.js?ver=<%=VixVerNum%>"></script>
6579 dpurdie 333
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
334
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
5623 dpurdie 335
      <script language="JavaScript" type="text/JavaScript">
336
      formTips.tips.h_buildplan       = stdTip(300, 'Build Plan', 'The build plan is a guess as to the order in which packages will be built.' +
337
                                                                  '<p>It will be recalculated before each build.' + 
338
                                                                  '<p>The plan includes test builds, new builds and resultant ripples.' 
339
                                                                  );
5670 dpurdie 340
      formTips.tips.h_buildDuration    = stdTip(300, 'Planned Duration', 'The build duration (seconds) of the last build of this package - if known.' +
5635 dpurdie 341
                                                                  '<p>This is used as a guess as to the duration of the planned build.' 
342
                                                                  );
5670 dpurdie 343
      formTips.tips.h_buildEnd         = stdTip(300, 'Planned Completion', 'An educated guess as to the build completion time of the package.' +
344
                                                                  '<p>It is based on the start time of the current build and the durations of each preceeding builds.' + 
345
                                                                  '<p>If the duration of a build is not known then a time of 300 seconds will be assumed.' +
346
                                                                  ' It also assumes 20 seconds to plan the next build.'
347
                                                                  );
5623 dpurdie 348
      formTips.tips.h_lastchange       = stdTip(300, 'Last Change', 'This is an indication of the time since the daemon interogated the database.' +
349
                                                                  '<p>Short times will be shown as seconds. Longer times will be shown as a time within ' + 
350
                                                                  'the last 24 hours. Longer times will be shown as a date.' 
351
                                                                  );
352
      </script>
353
      <!-- DROPDOWN MENUS -->
354
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 355
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
5623 dpurdie 356
   </head>
6548 dpurdie 357
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
5623 dpurdie 358
      <!-- HEADER -->
359
      <!--#include file="_header.asp"-->
360
      <!-- BODY ---->
6548 dpurdie 361
      <table class="full_table">
5623 dpurdie 362
         <tr>
6876 dpurdie 363
            <td width="146px" class="bg_panel" valign="top">
6548 dpurdie 364
                <%Call BuildMenuPane%>
365
            </td>
5623 dpurdie 366
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6548 dpurdie 367
                <%Call ShowDaemonStatus%>
368
                <%Call ShowBuildPlan%>
5623 dpurdie 369
            </td>
370
         </tr>
371
         <tr>
6877 dpurdie 372
            <td class="bg_panel_btm" height="350">
6548 dpurdie 373
                <img src="images/img_gears.png" vspace="20" hspace="30"></td>
5623 dpurdie 374
         </tr>
375
      </table>
376
      <!-- FOOTER -->
377
      <!--#include file="_footer.asp"-->
378
   </body>
379
</html>
6548 dpurdie 380