<commit_before>#!/bin/bash
# Run the connector 
set -e


# Set up go environment
export GOROOT=/go
export GOPATH=/gocode
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
mkdir -p $GOPATH/bin

# Pull cocoon source
branch="master"
repoOwner=github.com/ncodes
repoOwnerDir=$GOPATH/src/$repoOwner
mkdir -p $repoOwnerDir
cd $repoOwnerDir
printf "> Fetching cocoon source. [branch=$branch] [dest=$repoOwnerDir]\n"
rm -rf cocoon
git clone --depth=1 -b $branch https://$repoOwner/cocoon

# build the binary
printf "> Building cocoon"
cd cocoon
rm -rf .glide/ && rm -rf vendor
glide --debug install
/go/bin/go build -v -o $GOPATH/bin/cocoon core/main.go

# pull launch-go image
docker pull ncodes/launch-go:latest 

terminate() {
    printf "Terminate received!!!!\n"
    kill -TERM "$CPID" 2>/dev/null
    exit 0;
}

trap terminate TERM

# start connector 
printf "Running Cocoon Connector"
cocoon connector &
CPID=$!
printf "Waiting!"
wait "$CPID"<commit_msg>try out terminate<commit_after>#!/bin/bash
# Run the connector 
set -e


# # Set up go environment
# export GOROOT=/go
# export GOPATH=/gocode
# PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# mkdir -p $GOPATH/bin

# # Pull cocoon source
# branch="master"
# repoOwner=github.com/ncodes
# repoOwnerDir=$GOPATH/src/$repoOwner
# mkdir -p $repoOwnerDir
# cd $repoOwnerDir
# printf "> Fetching cocoon source. [branch=$branch] [dest=$repoOwnerDir]\n"
# rm -rf cocoon
# git clone --depth=1 -b $branch https://$repoOwner/cocoon

# # build the binary
# printf "> Building cocoon"
# cd cocoon
# rm -rf .glide/ && rm -rf vendor
# glide --debug install
# /go/bin/go build -v -o $GOPATH/bin/cocoon core/main.go

# # pull launch-go image
# docker pull ncodes/launch-go:latest 

terminate() {
    printf "Terminate received!!!!\n"
    # kill -TERM "$CPID" 2>/dev/null
    exit 0;
}

trap terminate TERM
sleep 1h

# # start connector 
# printf "Running Cocoon Connector"
# cocoon connector &
# CPID=$!
# printf "Waiting!"
# wait "$CPID"
{'fraction_non_alphanumeric': 0.14124293785310735, 'fraction_numerical': 0.0035952747817154596, 'mean_word_length': 3.994871794871795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1427359', 'n_tokens_mistral': 760, 'n_tokens_neox': 707, 'n_words': 201}