#! /bin/bash

export REWARD_PATH="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
export REPO_PATH=$(dirname $(dirname "$REWARD_PATH"))
export SRC_FILE="${REWARD_PATH}/eval_realworld_teleop.py"

if [ -z "$1" ]; then
    CONFIG_NAME="realworld_teleop"
else
    CONFIG_NAME=$1
fi

echo "Using Python at $(which python)"
LOG_DIR="${REPO_PATH}/logs/$(date +'%Y%m%d-%H:%M:%S')-${CONFIG_NAME}"
MEGA_LOG_FILE="${LOG_DIR}/eval_teleop.log"
mkdir -p "${LOG_DIR}"
CMD="python ${SRC_FILE} --config-path ${REWARD_PATH}/config/ --config-name ${CONFIG_NAME} runner.logger.log_path=${LOG_DIR}"
echo ${CMD} > ${MEGA_LOG_FILE}
${CMD} 2>&1 | tee -a "${MEGA_LOG_FILE}"
