Subversion Repositories DevTools

Rev

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