mason.server.watchdog: new tool to send e-mails when build machines go down
parent
1aaa756056
commit
7b6f84ad0e
|
@ -78,6 +78,9 @@ counter "COUNTER" {
|
||||||
[ [ [ clean-git-id>> ] [ release-git-id>> ] bi = not ] filter ]
|
[ [ [ clean-git-id>> ] [ release-git-id>> ] bi = not ] filter ]
|
||||||
tri ;
|
tri ;
|
||||||
|
|
||||||
|
: os/cpu ( builder -- string )
|
||||||
|
[ os>> ] [ cpu>> ] bi "/" glue ;
|
||||||
|
|
||||||
: mason-db ( -- db ) "resource:mason.db" <sqlite-db> ;
|
: mason-db ( -- db ) "resource:mason.db" <sqlite-db> ;
|
||||||
|
|
||||||
: with-mason-db ( quot -- )
|
: with-mason-db ( quot -- )
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Slava Pestov
|
|
@ -0,0 +1,36 @@
|
||||||
|
! Copyright (C) 2010 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: kernel math mason.email mason.server math.parser sequences
|
||||||
|
xml.syntax xml.writer ;
|
||||||
|
IN: mason.server.watchdog
|
||||||
|
|
||||||
|
: crashed-builder-body ( crashed-builders -- string content-type )
|
||||||
|
[ os/cpu [XML <li><-></li> XML] ] map
|
||||||
|
<XML
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p>Machines which have not sent a heartbeat for several hours:</p>
|
||||||
|
<ul><-></ul>
|
||||||
|
<a href="http://builds.factorcode.org/dashboard">Dashboard</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
XML> xml>string
|
||||||
|
"text/html" ;
|
||||||
|
|
||||||
|
: s ( n before after -- string )
|
||||||
|
pick 1 > [ "s" append ] when
|
||||||
|
[ number>string ] 2dip surround ;
|
||||||
|
|
||||||
|
: crashed-builder-subject ( crashed-builders -- string )
|
||||||
|
length "Take note: " " crashed build machine" s ;
|
||||||
|
|
||||||
|
: send-crashed-builder-email ( crashed-builders -- )
|
||||||
|
[ crashed-builder-body ]
|
||||||
|
[ crashed-builder-subject ] bi
|
||||||
|
mason-email ;
|
||||||
|
|
||||||
|
: check-builders ( -- )
|
||||||
|
[
|
||||||
|
funny-builders 2drop
|
||||||
|
[ send-crashed-builder-email ] unless-empty
|
||||||
|
] with-mason-db ;
|
|
@ -6,7 +6,7 @@ IN: webapps.mason.downloads
|
||||||
|
|
||||||
: builder-list ( seq -- xml )
|
: builder-list ( seq -- xml )
|
||||||
[
|
[
|
||||||
[ package-url ] [ [ os>> ] [ cpu>> ] bi "/" glue ] bi
|
[ package-url ] [ os/cpu ] bi
|
||||||
[XML <li><a href=<->><-></a></li> XML]
|
[XML <li><a href=<->><-></a></li> XML]
|
||||||
] map
|
] map
|
||||||
[ [XML <p>No machines.</p> XML] ]
|
[ [XML <p>No machines.</p> XML] ]
|
||||||
|
|
Loading…
Reference in New Issue