<commit_before>#!/usr/bin/env bash
RETRY=20
INTERVAL=5
DEFAULT_HOST="master-1"
SERVICE=$1
if [ -z $SERVICE ]; then
    echo "
This script will lookup for default port for SERVICE 
and try to connect it from $DEFAULT_HOST
Usage:
    $0 [SERVICE_NAME]	#Put here same name you are using in consul"
    exit 1
fi

SERVICE_IS_OK=false
while [ "x$SERVICE_IS_OK" != "xtrue"  -a  ${RETRY} -gt 0 ]; do
 SERVICE_IS_OK=`vagrant ssh ${DEFAULT_HOST} -c "curl -s http://localhost:8080/v2/apps/$SERVICE |jq -r .app.tasks[0].healthCheckResults[0].alive" | tail -n 1`
 RETRY=$[ $RETRY - 1 ]
 sleep $INTERVAL
done

vagrant ssh ${DEFAULT_HOST} -c "curl -s http://localhost:8080/v2/apps/SERVICE/namenode |jq -r .app.tasks[0].healthCheckResults[0].alive" | tail -n 1

if [ "x${SERVICE_IS_OK}" != "xtrue" ]; then
 echo "ERROR: Mesos do not see $SERVICE"
 exit 1
else
 echo "INFO: Mesos started $SERVICE"
fi

if [ $SERVICE == "hdfs/namenode"]; then
# HOTFIX: Now it works only with SERVICE needs to be fixed  jq -r .[0].ServiceTags 
	SERVICE_IP=`vagrant ssh ${DEFAULT_HOST} -c "curl -s localhost:8500/v1/catalog/service/hdfs | jq -r .[0].Address" | tail -n 1`
	SERVICE_PORT=`vagrant ssh ${DEFAULT_HOST} -c "curl -s localhost:8500/v1/catalog/service/hdfs |  jq -r .[0].ServiceTags | sed -n 's/.*\"http-\([0-9]*\)\".*/\1/p'" | tail -n 1`
	echo "
INFO: Found $SERVICE on ${SERVICE_IP} : ${SERVICE_PORT}
Executing curl from ${DEFAULT_HOST}...
"
	vagrant ssh ${DEFAULT_HOST} -c "curl -s  $SERVICE_IP\:$SERVICE_PORT " | grep "Licensed to the Apache Software Foundation (ASF)"
else
	SERVICE_IP=`vagrant ssh ${DEFAULT_HOST} -c "curl -s localhost:8500/v1/catalog/service/$SERVICE | jq -r .[0].Address" | tail -n 1`<commit_msg>Fix line 31 missing ] in wait-service-registration.sh<commit_after>#!/usr/bin/env bash
RETRY=20
INTERVAL=5
DEFAULT_HOST="master-1"
SERVICE=$1
if [ -z $SERVICE ]; then
    echo "
This script will lookup for default port for SERVICE 
and try to connect it from $DEFAULT_HOST
Usage:
    $0 [SERVICE_NAME]	#Put here same name you are using in consul"
    exit 1
fi

SERVICE_IS_OK=false
while [ "x$SERVICE_IS_OK" != "xtrue"  -a  ${RETRY} -gt 0 ]; do
 SERVICE_IS_OK=`vagrant ssh ${DEFAULT_HOST} -c "curl -s http://localhost:8080/v2/apps/$SERVICE |jq -r .app.tasks[0].healthCheckResults[0].alive" | tail -n 1`
 RETRY=$[ $RETRY - 1 ]
 sleep $INTERVAL
done

vagrant ssh ${DEFAULT_HOST} -c "curl -s http://localhost:8080/v2/apps/SERVICE/namenode |jq -r .app.tasks[0].healthCheckResults[0].alive" | tail -n 1

if [ "x${SERVICE_IS_OK}" != "xtrue" ]; then
 echo "ERROR: Mesos do not see $SERVICE"
 exit 1
else
 echo "INFO: Mesos started $SERVICE"
fi

if [ $SERVICE == "hdfs/namenode" ]; then
# HOTFIX: Now it works only with SERVICE needs to be fixed  jq -r .[0].ServiceTags 
	SERVICE_IP=`vagrant ssh ${DEFAULT_HOST} -c "curl -s localhost:8500/v1/catalog/service/hdfs | jq -r .[0].Address" | tail -n 1`
	SERVICE_PORT=`vagrant ssh ${DEFAULT_HOST} -c "curl -s localhost:8500/v1/catalog/service/hdfs |  jq -r .[0].ServiceTags | sed -n 's/.*\"http-\([0-9]*\)\".*/\1/p'" | tail -n 1`
	echo "
INFO: Found $SERVICE on ${SERVICE_IP} : ${SERVICE_PORT}
Executing curl from ${DEFAULT_HOST}...
"
	vagrant ssh ${DEFAULT_HOST} -c "curl -s  $SERVICE_IP\:$SERVICE_PORT " | grep "Licensed to the Apache Software Foundation (ASF)"
else
	SERVICE_IP=`vagrant ssh ${DEFAULT_HOST} -c "curl -s localhost:8500/v1/catalog/service/$SERVICE | jq -r .[0].Address" | tail -n 1`
{'fraction_non_alphanumeric': 0.16039661708953049, 'fraction_numerical': 0.03032954214056576, 'mean_word_length': 3.978229317851959, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2883342', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1323, 'n_words': 384}