<commit_before>#!/bin/bash
OC_DIR=$1
ARTIFACTS_DIR=$2

export PATH="$OC_DIR:$PATH"

function runcmd {
    echo ''
    echo "$1 : "
    $1
    echo ''
    echo '#######################################################################'
}

mkdir -p $ARTIFACTS_DIR/logs

for pod in `oc get pods -o jsonpath='{.items[*].metadata.name}'`
do
    for container in `oc get pod $pod -o jsonpath='{.spec.containers[*].name}'`
    do
        runcmd "oc logs -c $container $pod > ${ARTIFACTS_DIR}/logs/${pod}_${container}.log"
        if [ "$container" == "router" ]; then
            runcmd "oc rsh -c $container $pod qdmanage query --type=address > ${ARTIFACTS_DIR}/logs/${pod}_${container}_router_address.txt"
            runcmd "oc rsh -c $container $pod qdmanage query --type=connection > ${ARTIFACTS_DIR}/logs/${pod}_${container}_router_connection.txt"
            runcmd "oc rsh -c $container $pod qdmanage query --type=connector > ${ARTIFACTS_DIR}/logs/${pod}_${container}_router_connector.txt"
        fi
    done
done

for log in `find /tmp/testlogs`
do
    runcmd "cp $log $ARTIFACTS_DIR/logs/"
done<commit_msg>Fix redirect of log output<commit_after>#!/bin/bash
OC_DIR=$1
ARTIFACTS_DIR=$2

export PATH="$OC_DIR:$PATH"

function runcmd {
    local cmd=$1
    local logfile=$2
    echo "$cmd > $logfile"
    $cmd > $logfile
}

mkdir -p $ARTIFACTS_DIR/logs

for pod in `oc get pods -o jsonpath='{.items[*].metadata.name}'`
do
    for container in `oc get pod $pod -o jsonpath='{.spec.containers[*].name}'`
    do
        runcmd "oc logs -c $container $pod" ${ARTIFACTS_DIR}/logs/${pod}_${container}.log
        if [ "$container" == "router" ]; then
            runcmd "oc rsh -c $container $pod python /usr/bin/qdmanage query --type=address" ${ARTIFACTS_DIR}/logs/${pod}_${container}_router_address.txt
            runcmd "oc rsh -c $container $pod python /usr/bin/qdmanage query --type=connection"  ${ARTIFACTS_DIR}/logs/${pod}_${container}_router_connection.txt
            runcmd "oc rsh -c $container $pod python /usr/bin/qdmanage query --type=connector" ${ARTIFACTS_DIR}/logs/${pod}_${container}_router_connector.txt
        fi
    done
done

for log in `find /tmp/testlogs`
do
    cp -f $log $ARTIFACTS_DIR/logs/
done
{'fraction_non_alphanumeric': 0.1812443642921551, 'fraction_numerical': 0.0036068530207394047, 'mean_word_length': 3.4828282828282826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7539907', 'n_tokens_mistral': 788, 'n_tokens_neox': 753, 'n_words': 189}