<commit_before>#!/bin/bash -xue

install () {
    echo "Running 'install' phase"

    date

    if [[ -e ~/cache/image.tar.gz ]];
    then docker load -i ~/cache/image.tar.gz; fi

    date

    ./run_with_timeout_and_progress.sh 9000 ./docker/run.sh ubuntu-16.04 clean

    date
}

script () {
    echo "Running 'script' phase"

    date

    ./run_with_timeout_and_progress.sh 9000 ./docker/run.sh ubuntu-16.04 unit

    date
}

before_cache () {
    echo "Running 'before_cache' phase"

    date

    mkdir ~/cache || true
    docker save -o ~/cache/image.tar.gz arakoon_ubuntu-16.04
    ls -ahl ~/cache

    date
}

case "$1" in
    install)
        install
        ;;
    script)
        script
        ;;
    before_cache)
        before_cache
        ;;<commit_msg>speed up travis build by only updating the cache when needed<commit_after>#!/bin/bash -xue

install () {
    echo "Running 'install' phase"

    date

    if [[ -e ~/cache/image.tar.gz ]];
    then docker load -i ~/cache/image.tar.gz; fi

    START_BUILD=date
    export START_BUILD
    echo $START_BUILD

    ./run_with_timeout_and_progress.sh 9000 ./docker/run.sh ubuntu-16.04 clean

    END_BUILD=date
    export END_BUILD
    echo $END_BUILD
}

script () {
    echo "Running 'script' phase"

    date

    ./run_with_timeout_and_progress.sh 9000 ./docker/run.sh ubuntu-16.04 unit

    date
}

before_cache () {
    echo "Running 'before_cache' phase"

    date

    DIFF=$(echo "$END_BUILD - $START_BUILD" | bc)
    if [ $DIFF \> 5 ]
    then
        mkdir ~/cache || true
        docker save -o ~/cache/image.tar.gz arakoon_ubuntu-16.04
        ls -ahl ~/cache;
    else
        echo Building of container took only $DIFF seconds, not updating cache this time;
    fi

    date
}

case "$1" in
    install)
        install
        ;;
    script)
        script
        ;;
    before_cache)
        before_cache
        ;;
{'fraction_non_alphanumeric': 0.11228255139694254, 'fraction_numerical': 0.022667369530838165, 'mean_word_length': 2.0271132376395533, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5338161', 'n_tokens_mistral': 716, 'n_tokens_neox': 631, 'n_words': 167}