<commit_before>#!/bin/sh

SCRIPT_PATH=$(realpath $0)
SCRIPT_PREFIX=$(dirname ${SCRIPT_PATH})

. ${SCRIPT_PREFIX}/common.sh

PID="$1"
OUTPUT_DIR="$2"
OUTPUT="$3"
MESSAGE="$4"
RESULT="$5"
BUILDBOX="$6"
SANDBOX="$7"
OUTPUT_DIR_TMP=$(dirname ${OUTPUT})

test -z "$PID" && exit 1
test -z "$OUTPUT_DIR" && exit 1
test -z "$OUTPUT" && exit 1

sleep ${WATCHDOG_TIMEOUT}

if kill -9 $PID > /dev/null 2>&1; then
    if ! pkill -9 -U 65534; then
        msg "[watchdog] Could not stop processes owned by nobody."
    else
        msg "[watchdog] Had to kill nobody's all processes."
        mkdir -p ${OUTPUT_DIR_TMP}
        watchdog_output=$(mktemp)
        watchdog_message=$(mktemp)
        watchdog_result=$(mktemp)
        echo "Testing of this process has exceeded the time limit of ${WATCHDOG_TIMEOUT} seconds." > ${watchdog_output} 2>&1
        echo "Sorry, but automated testing of the solution was given up due to resource limits." > ${watchdog_message} 2>&1
        echo "False" > ${watchdog_result} 2>&1<commit_msg>Fix directory permissions for the watchdog-generated feedback.<commit_after>#!/bin/sh

SCRIPT_PATH=$(realpath $0)
SCRIPT_PREFIX=$(dirname ${SCRIPT_PATH})

. ${SCRIPT_PREFIX}/common.sh

PID="$1"
OUTPUT_DIR="$2"
OUTPUT="$3"
MESSAGE="$4"
RESULT="$5"
BUILDBOX="$6"
SANDBOX="$7"
OUTPUT_DIR_TMP=$(dirname ${OUTPUT})

test -z "$PID" && exit 1
test -z "$OUTPUT_DIR" && exit 1
test -z "$OUTPUT" && exit 1

sleep ${WATCHDOG_TIMEOUT}

if kill -9 $PID > /dev/null 2>&1; then
    if ! pkill -9 -U 65534; then
        msg "[watchdog] Could not stop processes owned by nobody."
    else
        msg "[watchdog] Had to kill nobody's all processes."
        mkdir -p ${OUTPUT_DIR_TMP}
        chmod g+rw,o+rw ${OUTPUT_DIR_TMP}
        watchdog_output=$(mktemp)
        watchdog_message=$(mktemp)
        watchdog_result=$(mktemp)
        echo "Testing of this process has exceeded the time limit of ${WATCHDOG_TIMEOUT} seconds." > ${watchdog_output} 2>&1
        echo "Sorry, but automated testing of the solution was given up due to resource limits." > ${watchdog_message} 2>&1
        echo "False" > ${watchdog_result} 2>&1
{'fraction_non_alphanumeric': 0.14494117647058824, 'fraction_numerical': 0.02447058823529412, 'mean_word_length': 3.682819383259912, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '5267894', 'n_tokens_mistral': 754, 'n_tokens_neox': 706, 'n_words': 218}