<commit_before>#!/usr/bin/env bash

# Starts a volttron central and platform agent.  The platform agent will
# tagged plat and the volttron central agent will be  tagged vc.
#
# After execting this shell script one should be able to browse to
# http://localhost:8080 and see the web interface.

export VOLTTRON_HOME=$HOME/.volttron

if [ ! -e "./applications" ]; then
    echo "Please execute from root of volttron repository."
    exit 0
fi

echo "Starting the vc platform and platform agent on the default volttron home."
SCRIPTS="./scripts/core"
PACK="$SCRIPTS/pack_install.sh"

VC="services/core/VolttronCentral"
VC_TAG="vc"
PLATFORM="services/core/Platform"
PLATFORM_TAG="plat"

START="volttron-ctl start"
STOP="volttron-ctl stop"
DEL="volttron-ctl remove"
CLEAR="volttron-ctl clear"

$STOP --tag $PLATFORM_TAG $VC_TAG
$DEL -f --tag $PLATFORM_TAG $VC_TAG

# Install and start VC.
$PACK $VC $VC/config $VC_TAG
$START --tag $VC_TAG

# Install and start platform.
$PACK $PLATFORM "$PLATFORM/config-devvm" $PLATFORM_TAG
$START --tag $PLATFORM_TAG

$CLEAR<commit_msg>Added platform start script that allows global variables for configuration files and parameters for one or the other or both vc and platform to be started<commit_after>#!/usr/bin/env bash

set -e

# Starts a volttron central and platform agent.  The platform agent will
# tagged plat and the volttron central agent will be  tagged vc.
#
# After execting this shell script one should be able to browse to
# http://localhost:8080 and see the web interface.

if [ ! -e "./applications" ]; then
    echo "Please execute from root of volttron repository."
    exit 0
fi

if [ -z $VOLTTRON_HOME ]
then
  echo "VOLTTRON_HOME not set setting to $HOME/.volttron"
  export VOLTTRON_HOME=$HOME/.volttron
fi

# Default case 
START_VC=0
START_PLATFORM=0
for var in "$@"
do
  if [ "$var" == "vc" ]; then
    START_VC=1
  fi
  if [ "$var" == "platform" ]; then
    START_PLATFORM=1
  fi
done

if [ "$START_VC" == "0" ] &&  [ "$START_PLATFORM" == "0" ]; then
  START_VC=1
  START_PLATFORM=1
fi

SCRIPTS="./scripts/core"
PACK="$SCRIPTS/pack_install.sh"

VC="services/core/VolttronCentral"
VC_TAG="vc"
  
PLATFORM="services/core/Platform"
PLATFORM_TAG="plat"

START="volttron-ctl start"
STOP="volttron-ctl stop"
DEL="volttron-ctl remove"
CLEAR="volttron-ctl clear"

# Install and start VC.
if [ "$START_VC" == 1 ];
then
  $STOP --tag $VC_TAG
  $DEL -f --tag $VC_TAG
  if [ -z $VC_CONFIG ]; then
    echo "VC_CONFIG set to $VC/config"
    VC_CONFIG=$VC/config
  fi
  echo "Starting Volttron Central with tag $VC_TAG"
  $PACK $VC "$VC_CONFIG" $VC_TAG
  $START --tag $VC_TAG
fi

if [ "$START_PLATFORM" == 1 ];
then
  $STOP --tag $PLATFORM_TAG
  $DEL -f --tag $PLATFORM_TAG
  if [ -z $PLATFORM_CONFIG ]; then
    echo "PLATFORM_CONFIG set to $PLATFORM/config"
    PLATFORM_CONFIG=$PLATFORM/config
  fi
  echo "Starting Platform agent with tag $PLATFORM_TAG"  
  $PACK $PLATFORM "$PLATFORM_CONFIG" $PLATFORM_TAG
  $START --tag $PLATFORM_TAG
fi

$CLEAR
{'fraction_non_alphanumeric': 0.11652754590984975, 'fraction_numerical': 0.00667779632721202, 'mean_word_length': 4.035294117647059, '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': '5261963', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1064, 'n_words': 338}