Subversion Repositories DevTools

Rev

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