run_and_open_dashboard.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # Get the directory of this script to make paths robust
  3. SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
  4. # The 'evals' directory is the parent of the script's directory
  5. EVALS_DIR=$(dirname "$SCRIPT_DIR")
  6. # Navigate to the evals directory to ensure npm commands run correctly
  7. cd "$EVALS_DIR"
  8. # Re-install dependencies and build the CLI
  9. echo "Ensuring dependencies are up to date and building CLI..."
  10. npm install && npm run build:cli
  11. # Check if the build was successful before proceeding
  12. if [ $? -ne 0 ]; then
  13. echo "CLI build failed. Aborting evaluation."
  14. exit 1
  15. fi
  16. # Run the evaluation script, passing all arguments from the command line
  17. echo "Running evaluation..."
  18. node ./cli/dist/index.js run-diff-eval "$@"
  19. # Check the exit code of the evaluation script
  20. if [ $? -eq 0 ]; then
  21. # If the script succeeded, open the dashboard in the background
  22. echo "Evaluation complete. Starting dashboard..."
  23. (cd "$SCRIPT_DIR/dashboard" && streamlit run app.py &)
  24. else
  25. # If the script failed, print an error message and exit
  26. echo "Evaluation failed. Dashboard will not be started."
  27. exit 1
  28. fi