<commit_before>#!/bin/bash
# 
# Two batch queues are generated:
#   A: queues user tasks (n jobs)
#   Z: queues the queue-handler (queues respawn: 1 job)
# Queues with higher letters run with increased niceness
# A is higher than Z, so A will run before Z


#
# Config:
#

JOBS_FILE='/path/to/your/jobs.file'
# load_avg maybe be something like: number of cores - 1
LOAD_AVG=3
# minimum interval in seconds between the start of two batch jobs
TIME_WINDOW=5

#
# Config end 
#

pushd $(dirname $0) > /dev/null
SCRIPT_PATH=$(pwd -P)
popd > /dev/null
SCRIPT=$(basename $0)
SCRIPT_FULLPATH=$SCRIPT_PATH/$SCRIPT

if [ $# -lt 1 ]
then
    echo "Usage : $SCRIPT_FULLPATH [start|stop|status]"
    exit
fi

case "$1" in

    "stop")

        for i in $(atq -q A | cut -f 1); do
            atrm $i;
        done
        for i in $(atq -q Z | cut -f 1); do
            atrm $i;
        done
        ;;

    "status")

        for i in $(atq | cut -f 1); do
            at -c $i |tail -2|head -1;
        done
        ;;

    "start")

        # rerun at-daemon with the specified parameters
        service atd stop
        atd -l $LOAD_AVG -b $TIME_WINDOW

        if [ ! $(atq -q A|wc -l) -gt 1 ]; then
        
            IFS=$'\r\n' TASKS=($(cat $JOBS_FILE))
            for t in "${TASKS[@]}"; do
                echo "$t" | at -M -q A now 
            done

        fi

        [ ! $(atq -q Z|wc -l) -gt 0 ] && echo "$SCRIPT_FULLPATH start" | at -q Z now
        ;;
esac
<commit_msg>Verbose status, removes stdout from at<commit_after>#!/bin/bash
# 
# Two batch queues are generated:
#   A: queues user tasks (n jobs)
#   Z: queues the queue-handler (queues respawn: 1 job)
# Queues with higher letters run with increased niceness
# A is higher than Z, so A will run before Z


#
# Config:
#

JOBS_FILE='/path/to/your/jobs.file'
# load_avg maybe be something like: number of cores - 1
LOAD_AVG=3
# minimum interval in seconds between the start of two batch jobs
TIME_WINDOW=5

#
# Config end 
#

pushd $(dirname $0) > /dev/null
SCRIPT_PATH=$(pwd -P)
popd > /dev/null
SCRIPT=$(basename $0)
SCRIPT_FULLPATH=$SCRIPT_PATH/$SCRIPT

if [ $# -lt 1 ]
then
    echo "Usage : $SCRIPT_FULLPATH [start|stop|status]"
    exit
fi

case "$1" in

    "stop")

        for i in $(atq -q A | cut -f 1); do
            atrm $i;
        done
        for i in $(atq -q Z | cut -f 1); do
            atrm $i;
        done
        ;;

    "status")

        if [ $(atq |wc -l) -gt 0 ]; then

            echo 'Running, at queued jobs:'
            for i in $(atq | cut -f 1); do
                at -c $i |tail -2|head -1;
            done
        fi
        ;;

    "start")

        # rerun at-daemon with the specified parameters
        service atd stop > /dev/null 2>&1
        atd -l $LOAD_AVG -b $TIME_WINDOW > /dev/null 2>&1

        if [ ! $(atq -q A|wc -l) -gt 1 ]; then
        
            IFS=$'\r\n' TASKS=($(cat $JOBS_FILE))
            for t in "${TASKS[@]}"; do
                echo "$t" | at -M -q A now > /dev/nul 2>&1
            done

        fi

        [ ! $(atq -q Z|wc -l) -gt 0 ] && echo "$SCRIPT_FULLPATH start" | at -q Z now > /dev/nul 2>&1
        ;;
esac

{'fraction_non_alphanumeric': 0.13240418118466898, 'fraction_numerical': 0.012353500158378208, 'mean_word_length': 1.8071111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1250382', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1136, 'n_words': 398}