mason.server.watchdog: new tool to send e-mails when build machines go down

release
Slava Pestov 2010-09-14 21:54:33 -07:00
parent 1aaa756056
commit 7b6f84ad0e
4 changed files with 41 additions and 1 deletions

View File

@ -78,6 +78,9 @@ counter "COUNTER" {
[ [ [ clean-git-id>> ] [ release-git-id>> ] bi = not ] filter ]
tri ;
: os/cpu ( builder -- string )
[ os>> ] [ cpu>> ] bi "/" glue ;
: mason-db ( -- db ) "resource:mason.db" <sqlite-db> ;
: with-mason-db ( quot -- )

View File

@ -0,0 +1 @@
Slava Pestov

View File

@ -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 ;

View File

@ -6,7 +6,7 @@ IN: webapps.mason.downloads
: builder-list ( seq -- xml )
[
[ package-url ] [ [ os>> ] [ cpu>> ] bi "/" glue ] bi
[ package-url ] [ os/cpu ] bi
[XML <li><a href=<->><-></a></li> XML]
] map
[ [XML <p>No machines.</p> XML] ]