<commit_before>#!/bin/bash

yum -y install unzip java wget

curl -O https://raw.githubusercontent.com/wallix/awless/master/getawless.sh
/bin/bash getawless.sh
mv awless /usr/local/bin

ZOOKEEPER_IP=$(/usr/local/bin/awless ls instances --filter name=zookeeper --format csv | tail -1 | cut -d, -f7)

echo "Resolved Zookeeper private IP is $ZOOKEEPER_IP"

KAFKA_DOWNLOAD=kafka_2.12-0.10.2.1

wget http://apache.mediamirrors.org/kafka/0.10.2.1/$KAFKA_DOWNLOAD.tgz

tar -zxvf $KAFKA_DOWNLOAD.tgz -C /opt
ln -s /opt/$KAFKA_DOWNLOAD /opt/kafka

mkdir /tmp/kafka-logs

INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
BROKER_ID=$(/usr/local/bin/awless ls instances --filter name=broker --sort name --format tsv | tail -n +2 | grep $INSTANCE_ID -n | cut -d: -f1)

sed -i.bak "s/zookeeper.connect=.*/zookeeper.connect=$ZOOKEEPER_IP:2181/g" /opt/kafka/config/server.properties
sed -i.bak "s/broker.id=.*/broker.id=$BROKER_ID/g" /opt/kafka/config/server.properties

nohup /opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties > /dev/null 2>&1 &<commit_msg>Fix: only filtering running instances<commit_after>#!/bin/bash

yum -y install unzip java wget

curl -O https://raw.githubusercontent.com/wallix/awless/master/getawless.sh
/bin/bash getawless.sh
mv awless /usr/local/bin

ZOOKEEPER_IP=$(/usr/local/bin/awless ls instances --filter name=zookeeper --filter state=run --format csv | tail -1 | cut -d, -f7)

KAFKA_DOWNLOAD=kafka_2.12-0.10.2.1

wget http://apache.mediamirrors.org/kafka/0.10.2.1/$KAFKA_DOWNLOAD.tgz

tar -zxvf $KAFKA_DOWNLOAD.tgz -C /opt
ln -s /opt/$KAFKA_DOWNLOAD /opt/kafka

mkdir /tmp/kafka-logs

INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
BROKER_ID=$(/usr/local/bin/awless ls instances --filter name=broker --sort name --format tsv | tail -n +2 | grep $INSTANCE_ID -n | cut -d: -f1)

sed -i.bak "s/zookeeper.connect=.*/zookeeper.connect=$ZOOKEEPER_IP:2181/g" /opt/kafka/config/server.properties
sed -i.bak "s/broker.id=.*/broker.id=$BROKER_ID/g" /opt/kafka/config/server.properties

nohup /opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties > /dev/null 2>&1 &
{'fraction_non_alphanumeric': 0.16435185185185186, 'fraction_numerical': 0.032407407407407406, 'mean_word_length': 3.9002267573696145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '3710403', 'n_tokens_mistral': 966, 'n_tokens_neox': 898, 'n_words': 161}