<commit_before>#/bin/bash

set -e
set -u
set -x

function join_by { local IFS="$1"; shift; echo "$*"; }

STATEFUL_SETS=$(curl -f -k https://kubernetes/apis/apps/v1beta1/statefulsets -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)")
STATSD_NODES_SS=$(echo $STATEFUL_SETS | jq '.items[] | select(.metadata.name == "statsd-daemon")')
REPLICAS=$(echo $STATSD_NODES_SS | jq .spec.replicas)
SERVICE_NAME=$(echo $STATSD_NODES_SS | jq .spec.serviceName | tr -d '"')
(( REPLICAS-= 1 ))
NODES=()
echo "Building nodes list"

for i in $(seq 0 $REPLICAS)
do
  NODES+=("{host: 'statsd-daemon-$i.$SERVICE_NAME', port: 8125, adminport:8126}")
done

JOINED=$(join_by , "${NODES[@]}")

sed -i "s/@@STATSD_NODES@@/$JOINED/g" /app/statsd/proxyConfig.js

for i in $(seq 0 $REPLICAS)
do
  echo "erez"
  echo $i
done<commit_msg>removed redundant code<commit_after>#/bin/bash

set -e
set -u
set -x

function join_by { local IFS="$1"; shift; echo "$*"; }

STATEFUL_SETS=$(curl -f -k https://kubernetes/apis/apps/v1beta1/statefulsets -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)")
STATSD_NODES_SS=$(echo $STATEFUL_SETS | jq '.items[] | select(.metadata.name == "statsd-daemon")')
REPLICAS=$(echo $STATSD_NODES_SS | jq .spec.replicas)
SERVICE_NAME=$(echo $STATSD_NODES_SS | jq .spec.serviceName | tr -d '"')
(( REPLICAS-= 1 ))
NODES=()
echo "Building nodes list"

for i in $(seq 0 $REPLICAS)
do
  NODES+=("{host: 'statsd-daemon-$i.$SERVICE_NAME', port: 8125, adminport:8126}")
done

JOINED=$(join_by , "${NODES[@]}")

sed -i "s/@@STATSD_NODES@@/$JOINED/g" /app/statsd/proxyConfig.js
{'fraction_non_alphanumeric': 0.19301470588235295, 'fraction_numerical': 0.016544117647058824, 'mean_word_length': 5.0036764705882355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4998495', 'n_tokens_mistral': 696, 'n_tokens_neox': 685, 'n_words': 141}