<commit_before>#!/bin/bash

VENV_ROOT=$WORKSPACE/venvs
mkdir -p $VENV_ROOT

rm -rf $WORKSPACE/logs

virtualenv $VENV_ROOT/analytics-tasks
virtualenv $VENV_ROOT/analytics-configuration

TASKS_BIN=$VENV_ROOT/analytics-tasks/bin
CONF_BIN=$VENV_ROOT/analytics-configuration/bin

. $CONF_BIN/activate
make -C analytics-configuration provision.emr

function terminate_cluster() {
    . $CONF_BIN/activate
    make -C analytics-configuration terminate.emr
}
if [ "$TERMINATE" = "true" ]; then
    trap terminate_cluster EXIT
fi

. $TASKS_BIN/activate
make -C analytics-tasks install

# Define task on the command line, including the task name and all of its arguments.
# All arguments provided on the command line are passed through to the remote-task call.
remote-task --job-flow-name="$CLUSTER_NAME" --branch $TASKS_BRANCH --wait --log-path $WORKSPACE/logs/ --remote-name automation --user $TASK_USER --secure-config-branch $SECURE_BRANCH --secure-config-repo $SECURE_REPO --secure-config $SECURE_CONFIG "$@"

cat $WORKSPACE/logs/*<commit_msg>Fail fast if provisioning fails<commit_after>#!/bin/bash

set -ex

VENV_ROOT=$WORKSPACE/venvs
mkdir -p $VENV_ROOT

rm -rf $WORKSPACE/logs

virtualenv $VENV_ROOT/analytics-tasks
virtualenv $VENV_ROOT/analytics-configuration

TASKS_BIN=$VENV_ROOT/analytics-tasks/bin
CONF_BIN=$VENV_ROOT/analytics-configuration/bin

. $CONF_BIN/activate
make -C analytics-configuration provision.emr

function terminate_cluster() {
    . $CONF_BIN/activate
    make -C analytics-configuration terminate.emr
}
if [ "$TERMINATE" = "true" ]; then
    trap terminate_cluster EXIT
fi

. $TASKS_BIN/activate
make -C analytics-tasks install

# Define task on the command line, including the task name and all of its arguments.
# All arguments provided on the command line are passed through to the remote-task call.
remote-task --job-flow-name="$CLUSTER_NAME" --branch $TASKS_BRANCH --wait --log-path $WORKSPACE/logs/ --remote-name automation --user $TASK_USER --secure-config-branch $SECURE_BRANCH --secure-config-repo $SECURE_REPO --secure-config $SECURE_CONFIG "$@"

cat $WORKSPACE/logs/* || true
{'fraction_non_alphanumeric': 0.1103742302226433, 'fraction_numerical': 0.0, 'mean_word_length': 4.6021220159151195, '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': '4900291', 'n_tokens_mistral': 699, 'n_tokens_neox': 692, 'n_words': 180}