<commit_before>#!/bin/bash

set -ex
EXTRA_ARGS=""
if [ ! -z $COREOS ]; then
  EXTRA_ARGS="$EXTRA_ARGS --coreos"
fi
if [ ! -z $DEBUG ]; then
  EXTRA_ARGS="$EXTRA_ARGS --vmodule=*=3"
fi
if [ ! -x $CADVISOR_PORT ]; then
  EXTRA_ARGS="$EXTRA_ARGS --cadvisor_port=$CADVISOR_PORT"
fi

HEAPSTER="/usr/bin/heapster $EXTRA_ARGS "
# Check if InfluxDB service is running
if [ ! -z $KUBERNETES_RO_SERVICE_HOST ]; then
  # TODO(vishh): add support for passing in user name and password.    
  INFLUXDB_ADDRESS=""
  if [ ! -z $MONITORING_INFLUXDB_SERVICE_HOST ]; then
    INFLUXDB_ADDRESS="${MONITORING_INFLUXDB_SERVICE_HOST}:${MONITORING_INFLUXDB_SERVICE_PORT}"
  elif [ ! -z $INFLUXDB_HOST ]; then
    INFLUXDB_ADDRESS=${INFLUXDB_HOST}
  else 
    echo "InfluxDB service address not found. Exiting."
    exit 1
  fi
  $HEAPSTER --kubernetes_master "${KUBERNETES_RO_SERVICE_HOST}:${KUBERNETES_RO_SERVICE_PORT}" --sink influxdb --sink_influxdb_host $INFLUXDB_ADDRESS
elif [ ! -z $INFLUXDB_HOST ]; then
  $HEAPSTER --sink influxdb --sink_influxdb_host ${INFLUXDB_HOST}
else
  $HEAPSTER
fi
<commit_msg>Use GCM sink if SINK=gcm is specified.<commit_after>#!/bin/bash

set -ex
EXTRA_ARGS=""
if [ ! -z $COREOS ]; then
  EXTRA_ARGS="$EXTRA_ARGS --coreos"
fi
if [ ! -z $DEBUG ]; then
  EXTRA_ARGS="$EXTRA_ARGS --vmodule=*=3"
fi
if [ ! -x $CADVISOR_PORT ]; then
  EXTRA_ARGS="$EXTRA_ARGS --cadvisor_port=$CADVISOR_PORT"
fi

# If in Kubernetes, target the master.
if [ ! -z $KUBERNETES_RO_SERVICE_HOST ]; then
  EXTRA_ARGS="$EXTRA_ARGS --kubernetes_master ${KUBERNETES_RO_SERVICE_HOST}:${KUBERNETES_RO_SERVICE_PORT}"
fi

# Select what source sink to use. Options: "influxdb,gcm"
# Default is InfluxDB.
if [ -x $SINK ]; then
  SINK="influxdb"
fi

HEAPSTER="/usr/bin/heapster $EXTRA_ARGS "

if [ "$SINK" == "influxdb" ]; then
  HEAPSTER="$HEAPSTER --sink influxdb"

  # Check if in Kubernetes.
  if [ ! -z $KUBERNETES_RO_SERVICE_HOST ]; then
    # TODO(vishh): add support for passing in user name and password.
    INFLUXDB_ADDRESS=""
    if [ ! -z $MONITORING_INFLUXDB_SERVICE_HOST ]; then
      INFLUXDB_ADDRESS="${MONITORING_INFLUXDB_SERVICE_HOST}:${MONITORING_INFLUXDB_SERVICE_PORT}"
    elif [ ! -z $INFLUXDB_HOST ]; then
      INFLUXDB_ADDRESS=${INFLUXDB_HOST}
    else
      echo "InfluxDB service address not specified. Exiting."
      exit 1
    fi
    $HEAPSTER --sink_influxdb_host $INFLUXDB_ADDRESS
  elif [ ! -z $INFLUXDB_HOST ]; then
    $HEAPSTER --sink_influxdb_host ${INFLUXDB_HOST}
  else
    $HEAPSTER
  fi
elif [ "$SINK" == "gcm" ]; then
  $HEAPSTER --sink gcm
else
  $HEAPSTER
fi

{'fraction_non_alphanumeric': 0.12727978269305393, 'fraction_numerical': 0.0015521924718665113, 'mean_word_length': 4.208080808080808, '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': '5746773', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1028, 'n_words': 222}