<commit_before>! Copyright (C) 2008, 2010 <NAME>, <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors calendar continuations debugger io
io.directories io.pathnames io.sockets io.streams.string kernel
mason.config mason.disk mason.email mason.notify mason.updates
namespaces prettyprint threads ;
FROM: mason.build => build ;
IN: mason

: heartbeat-loop ( -- )
    notify-heartbeat
    5 minutes sleep
    heartbeat-loop ;

: fatal-error-body ( error callstack -- string )
    [
        "Fatal error on " write host-name print nl
        [ error. ] [ callstack. ] bi*
    ] with-string-writer ;

: build-loop-error ( error callstack -- )
    fatal-error-body
     "build loop error"
     email-fatal ;

: build-loop ( -- )
    [
        builds-dir get make-directories
        builds-dir get [
            check-disk-space
            update-sources
            build? [ build ] [ 5 minutes sleep ] if
        ] with-directory
    ] [
        error-continuation get call>> build-loop-error
        5 minutes sleep
    ] recover

    build-loop ;

: mason ( -- * )
    [ heartbeat-loop ] "Heartbeat loop" spawn
    [ build-loop ] "Build loop" spawn
    stop ;

MAIN: mason<commit_msg>mason: change stack effect of mason.<commit_after>! Copyright (C) 2008, 2010 <NAME>, <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors calendar continuations debugger io
io.directories io.pathnames io.sockets io.streams.string kernel
mason.config mason.disk mason.email mason.notify mason.updates
namespaces prettyprint threads ;
FROM: mason.build => build ;
IN: mason

: heartbeat-loop ( -- )
    notify-heartbeat
    5 minutes sleep
    heartbeat-loop ;

: fatal-error-body ( error callstack -- string )
    [
        "Fatal error on " write host-name print nl
        [ error. ] [ callstack. ] bi*
    ] with-string-writer ;

: build-loop-error ( error callstack -- )
    fatal-error-body
     "build loop error"
     email-fatal ;

: build-loop ( -- )
    [
        builds-dir get make-directories
        builds-dir get [
            check-disk-space
            update-sources
            build? [ build ] [ 5 minutes sleep ] if
        ] with-directory
    ] [
        error-continuation get call>> build-loop-error
        5 minutes sleep
    ] recover

    build-loop ;

: mason ( -- )
    [ heartbeat-loop ] "Heartbeat loop" spawn
    [ build-loop ] "Build loop" spawn
    stop ;

MAIN: mason
{'fraction_non_alphanumeric': 0.10829587249693502, 'fraction_numerical': 0.008990600735594606, 'mean_word_length': 2.2903225806451615, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3185638', 'n_tokens_mistral': 770, 'n_tokens_neox': 745, 'n_words': 206}