: increment-counter-value ( -- n )
counter-tuple [ 0 or 1 + dup ] change-value update-tuple ;
+: all-builders ( -- builders )
+ builder new select-tuples ; inline
+
+: crashed? ( builder -- ? )
+ heartbeat-timestamp>> 30 minutes ago before? ;
+
+: broken? ( builder -- ? )
+ [ clean-git-id>> ] [ last-git-id>> ] bi = not ;
+
: funny-builders ( -- crashed broken )
- builder new select-tuples
- [ [ heartbeat-timestamp>> 30 minutes ago before? ] filter ]
- [ [ [ clean-git-id>> ] [ last-git-id>> ] bi = not ] filter ]
+ all-builders
+ [ [ crashed? ] filter ]
+ [ [ broken? ] filter ]
bi ;
: os/cpu ( builder -- string )
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
<t:title>Mason dashboard</t:title>
- <h1>Crashed build machines</h1>
- <p>Machines which are not sending heartbeats:</p>
- <t:xml t:name="crashed" />
-
- <h1>Broken build machines</h1>
- <p>Machines with failing builds:</p>
- <t:xml t:name="broken" />
+ <h1>Build machines</h1>
+ <t:xml t:name="builders" />
<h1>Force build now</h1>
<p>Requires build engineer status.</p>
! Copyright (C) 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel furnace.actions html.forms sequences
-xml.syntax webapps.mason.backend webapps.mason.utils ;
+USING: accessors combinators kernel furnace.actions html.forms
+sequences sorting xml.syntax webapps.mason.backend
+webapps.mason.utils ;
IN: webapps.mason.downloads
+CONSTANT: CRASHED
+[XML <span style="background-color: yellow;">CRASHED</span> XML]
+
+CONSTANT: BROKEN
+[XML <span style="background-color: red; color: white;">BROKEN</span> XML]
+
+: builder-status ( builder -- status/f )
+ {
+ { [ dup crashed? ] [ drop CRASHED ] }
+ { [ dup broken? ] [ drop BROKEN ] }
+ [ drop f ]
+ } cond ;
+
: builder-list ( seq -- xml )
+ [ os/cpu ] sort-with
[
- [ report-url ] [ os/cpu ] bi
- [XML <li><a href=<->><-></a></li> XML]
+ [ report-url ] [ os/cpu ] [ builder-status ] tri
+ [XML <li><a href=<->><-></a> <-></li> XML]
] map
[ [XML <p>No machines.</p> XML] ]
[ [XML <ul><-></ul> XML] ]
<page-action>
[
[
- funny-builders
- [ builder-list ] bi@
- [ "crashed" set-value ]
- [ "broken" set-value ] bi*
+ all-builders builder-list
+ "builders" set-value
] with-mason-db
] >>init ;