<commit_before>#!/bin/bash
# executed as ROOT on AWS and Vagrant
# called regularly to install/reset project formulas, update the master config
# python logic lives in ./builder/src/remote_master.py

set -e # everything must pass
set -u # no unbound variables
set -xv  # output the scripts and interpolated steps

cd /opt/builder-private
if [ ! -d /vagrant ]; then
    # NOT vagrant. if this were vagrant, any dev changes would be reset
    git reset --hard
    git pull --rebase
fi


cd /opt/builder/


if [ ! -d /vagrant ]; then
    # NOT vagrant. if this were vagrant, any dev changes would be reset
    git reset --hard
    git pull --rebase
fi

# hook!
# custom builder settings.yml for the master server
if [ -e /opt/builder-private/master-server-settings.yml ]; then
    rm -f settings.yml
    ln -s /opt/builder-private/master-server-settings.yml settings.yml
fi

# install/update any python requirements
/bin/bash .activate-venv.sh

# replace the master config, if it exists, with the builder-private copy ...
cp /opt/builder-private/etc-salt-master /etc/salt/master
# ... then clone/pull all formula repos and update master config
BLDR_ROLE=master ./bldr remote_master.refresh

service salt-master stop || true

sleep 2

sudo killall -9 salt-master || true

service salt-master start
<commit_msg>linted<commit_after>#!/bin/bash
# executed as ROOT on AWS and Vagrant
# called regularly to install/reset project formulas, update the master config
# python logic lives in ./builder/src/remote_master.py

set -e # everything must pass
set -u # no unbound variables
set -xv  # output the scripts and interpolated steps

cd /opt/builder-private
if [ ! -d /vagrant ]; then
    # NOT vagrant. if this were vagrant, any dev changes would be reset
    git reset --hard
    git pull --rebase
fi


cd /opt/builder/
if [ ! -d /vagrant ]; then
    # NOT vagrant. if this were vagrant, any dev changes would be reset
    git reset --hard
    git pull --rebase
fi

# hook!
# custom builder settings.yml for the master server
if [ -e /opt/builder-private/master-server-settings.yml ]; then
    rm -f settings.yml
    ln -s /opt/builder-private/master-server-settings.yml settings.yml
fi

# install/update any python requirements
/bin/bash .activate-venv.sh

# replace the master config, if it exists, with the builder-private copy ...
cp /opt/builder-private/etc-salt-master /etc/salt/master
# ... then clone/pull all formula repos and update master config
BLDR_ROLE=master ./bldr remote_master.refresh

service salt-master stop || true

sleep 2

sudo killall -9 salt-master || true

service salt-master start

{'fraction_non_alphanumeric': 0.09296965040338072, 'fraction_numerical': 0.001536688436419516, 'mean_word_length': 3.2204213938411668, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '323498', 'n_tokens_mistral': 818, 'n_tokens_neox': 782, 'n_words': 314}